Quicksync inappropriate default settings?

Archive of historical bug reports.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Quicksync inappropriate default settings?

Post by gmb »

Default advanced settings from Handbrake:

gop-ref-dist=4:gop-pic-size=32:async-depth=4

Screenshots: http://img21.imageshack.us/img21/1430/s500.png
http://img19.imageshack.us/img19/3738/6vb2.png


Tweaked settings:

gop-ref-dist=8:gop-pic-size=64:async-depth=4:num-ref-frame=2

Screenshots: http://img545.imageshack.us/img545/6904/hl3.png
http://img18.imageshack.us/img18/6168/1bxz.png



Apart from the settings above everything the same. Output bitrate the
same. Encoding time the same. Doubling gop-pic-size, gop-ref-dist and using manual
num-ref-frame made a huge difference in Handbrake. Much more details
can be seen. Looks like default settings are struggling in Handbrake with Haswell.
Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

I've seen cases where doubling gop-ref-dist has an effect on encoding speed, though it doesn't happen with all sources.

The default gop-pic-size will be 5*framerate+1 in the next build, except for CQP where it will remain 32 (don't ask me why, this may change in a later build).

I'll revisit default settings and Haswell-specific issues after the next build is out.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

I tested even higher gop-pic-size values but it lowered the image quality. 64 was the sweetspot. My test video has 24 fps. num-ref-frame=2 is also a bit strange. The encoder already uses 2 or 3 ref frames automatically but when I set 2 or 3 manually in Handbrake I get better image quality, at least in my test video I used. Makes no sense but this is what I get.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

I have tried your 5*framerate+1 formula and it's brilliant. Even better than gop 64.

gop-ref-dist=9:gop-pic-size=121:async-depth=4:num-ref-frame=2:mbbrc=1
http://img842.imageshack.us/img842/84/2qah.png
http://img11.imageshack.us/img11/5572/2wvr.png

First picture maybe not better but the second is way better than before. Compared to default Handbrake a huge difference.


I also tried a 60 fps video where 5*framerate+1 works best.

default: gop-ref-dist=4:gop-pic-size=32:async-depth=4= http://img841.imageshack.us/img841/6636/1jbw.png


modded: gop-ref-dist=4:gop-pic-size=301:async-depth=4:num-ref-frame=2= http://img96.imageshack.us/img96/8562/w2x.png


gop-ref-dist=4 worked better than 8 or 9 in this video. Do you have a formula for gop-ref-dist?
Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

gmb wrote:I have tried your 5*framerate+1 formula and it's brilliant. Even better than gop 64.
Was recommended by someone at Intel.

One thing you could try, is to use the formula but then round the framerate to a multiple of gop-ref-dist (e.g. with gop-ref-dist=8, 5*24+1 = 121, round to 128). On Haswell, this should enable B-pyramid (depending on gop-ref-dist, see below), which may improve the results somewhat (haven't done extensive testing yet).
gmb wrote:gop-ref-dist=4 worked better than 8 or 9 in this video. Do you have a formula for gop-ref-dist?
All I know from testing is that B-pyramid seems to get enabled by powers of 2 (4, 8, 16, etc.). 16 does seem to cause some hangs when we decode with QSV, though, so I'd recommend 4 or 8 for know (obviously we'd like to get the hang fixed eventually).
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

I had playback glitches with high gop-ref-dist values like 16 or more. Test video 1 worked best with 8 and 9 (slightly better with 9). Test video 2 worked best with 4, looks like it is video dependent. 4 or 8/9 gop-ref-dist maybe the best depending on the input video. I think I tried 128 gop-pic-size already for my 24 fps video, it was quite good too. But wait I did use 9 gop-ref-dist, I should try 129 gop-pic-size then.
Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

gmb wrote:But wait I did use 9 gop-ref-dist, I should try 129 gop-pic-size then.
The math doesn't seem to add up here. 129 is not a multiple of 9, but 126 is. Also, 9 is not a power of 2, so B-pyramid won't get enabled (at least not with the driver I've been testing, and I don't think it varies much if at all with other drivers).
Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

FWIW, the next build will use the keyframe intervals described above (5*fps+1, or 32 for CQP). But eventually we will probably automatically adjust it so that it's a multiple of gop-ref-dist - since it hasn't been extensively tested yet, we're going with Intel's recommendation for now.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

Rodeo wrote:
gmb wrote:But wait I did use 9 gop-ref-dist, I should try 129 gop-pic-size then.
The math doesn't seem to add up here. 129 is not a multiple of 9, but 126 is. Also, 9 is not a power of 2, so B-pyramid won't get enabled (at least not with the driver I've been testing, and I don't think it varies much if at all with other drivers).

gop-ref-dist=9 looks better than gop-ref-dist=8 at the same bitrate in my two test videos. Video 1 is 24 fps and video 2 60 fps. First is the Intel formula and second the multiple of x. Are these pic-size numbers correct?

Video 1
gop-ref-dist=4:gop-pic-size=121
gop-ref-dist=4:gop-pic-size=120/124

gop-ref-dist=8:gop-pic-size=121
gop-ref-dist=8:gop-pic-size=128

gop-ref-dist=9:gop-pic-size=121
gop-ref-dist=9:gop-pic-size=126


Video 2
gop-ref-dist=4:gop-pic-size=301
gop-ref-dist=4:gop-pic-size=304/300?

gop-ref-dist=8:gop-pic-size=301
gop-ref-dist=8:gop-pic-size=304

gop-ref-dist=9:gop-pic-size=301
gop-ref-dist=9:gop-pic-size=306
Last edited by gmb on Sat Jul 20, 2013 1:03 pm, edited 1 time in total.
Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

gmb wrote:Are these pic-size numbers correct?

Video 1
gop-ref-dist=4:gop-pic-size=121
gop-ref-dist=4:gop-pic-size=304
Nope, that doesn't look right.
gmb wrote:gop-ref-dist=8:gop-pic-size=121
gop-ref-dist=8:gop-pic-size=128

gop-ref-dist=9:gop-pic-size=121
gop-ref-dist=9:gop-pic-size=126
Looks OK, but having gop-pic-isze be a multiple of gop-ref-dist is irrelevant is gop-ref-dist is not a power of 2, as B-pyramid won't get enabled. I suppose it doesn't hurt though.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

I have tested all the listed variants above. Bitrate etc the same, only the gop values are different. First video 1 (24 fps).

gop-ref-dist=4:gop-pic-size=121
http://imageshack.us/a/img203/3505/zsqu.png
http://imageshack.us/a/img203/4466/6rwd.png

gop-ref-dist=4:gop-pic-size=120
http://imageshack.us/a/img69/4862/4baf.png
http://imageshack.us/a/img191/7296/in4z.png

gop-ref-dist=4:gop-pic-size=124
http://imageshack.us/a/img833/5334/kum9.png
http://imageshack.us/a/img832/8969/b36b.png

gop-ref-dist=8:gop-pic-size=121
http://imageshack.us/a/img43/2331/s7i.png
http://imageshack.us/a/img11/843/5s00.png

gop-ref-dist=8:gop-pic-size=128
http://imageshack.us/a/img713/3469/ohfk.png
http://img835.imageshack.us/img835/4229/3hz.png

gop-ref-dist=9:gop-pic-size=121
http://imageshack.us/a/img542/7610/lw38.png
http://imageshack.us/a/img839/9996/fzqz.png

gop-ref-dist=9:gop-pic-size=126
http://imageshack.us/a/img836/5864/l9n.png
http://imageshack.us/a/img854/7972/0kww.png


The best for me is gop-ref-dist=9:gop-pic-size=121
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

It seems the rounded method stutters a bit with lookahead, so I would stay with Intels recommendation which runs fine with lookahead. Could be a QSTranscode issue though. The question about the optimal gop-ref-dist remains. I will do a second test with another video.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

Are 23.976 fps rounded to 24 and then 5*framerate+1=121?

Because with 23*5+1 goppicsize 116 it stutters and encoding time is longer. 23.976 videos should be rounded to 24 for the formula.
Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

Yes, we round it.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

I found small glitches with higher gop-ref-dist values like 6 and 8 in some videos. It seems SDK uses by default 3. Why does Handbrake enforce it to 4? Is this recommended by Intel? I did some comparisons and 3 looked better.
Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

Not sure why we default to 4, but it does allow for up to 3 consecutive B-frames, which matches the x264 default.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

But Intels SDK uses 3 by default. I will do some more comparisons with 4.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

First example from the Avatar trailer.

Original
http://s14.directupload.net/images/130724/twuqtf4b.png


gop-ref-dist=3
http://s7.directupload.net/images/130724/c3cq5kyl.png


gop-ref-dist=4
http://s1.directupload.net/images/130724/f5rfm5zp.png


dist4 has distorted colours and detail preservation is worse.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

Original
http://s7.directupload.net/images/130724/o4463fgm.png



gop-ref-dist=3
http://s1.directupload.net/images/130724/z3ab79k4.png



gop-ref-dist=4
http://s14.directupload.net/images/130724/xskkanjq.png


Better detail preservation from dist3 which also results in a bigger screenshot size. I'm worried about the colour distortion, that's a no-go for a default value. I think there is a reason why Intel uses dist3 as default.
Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

It's either an encoding bug or a decoding bug. What did you use for capturing those screenshots? What gop-pic-size did you use?
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

Bug or not bug, default SDK value don't suffer. It's very similar with QSTranscode so it shouldn't be a Handbrake exclusive issue. As for the gopsize I used Intels formula.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

Deleted User 11865

Re: Quicksync inappropriate default settings?

Post by Deleted User 11865 »

Interesting.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: Quicksync inappropriate default settings?

Post by gmb »

I would go with SDK default as a default setting for both gop, means dist=1 size=1. There are some odd issues.
Post Reply