View Full Version : Number of Ref frames / amount of compression
Lathe
27th February 2020, 06:51
Hello all!
I asked something similar last year, but I don't think I asked it very well :) So, I didn't quite get the answer that I THINK I need.
In doing a 1 Pass ABR compression for a Blu-ray where there is VERY LITTLE compression being done. Say for example a file is being compressed from a size of 25 Gigs to 22 Gigs. The resulting encode will be around a 24,000 bitrate, which is pretty decent. Normally, I like to thrown in a couple of little 'Tweaks' such as me-hex and subme-6 so that I can activate both the Psy and Trellis settings and give them a little bump. With this in mind using a VeryFast setting, and YES I am aware of the parameters included in that preset, since the resulting encoded bitrate is pretty high, is the default ref-1 setting 'good enough' or would adding an additional 'Tweak' setting the ref frames higher (2-4) make any discernible visual difference in your opinions.
In other words, should I just leave the ref-1 setting, or should I bother to increase the refs since the resulting bitrate will be fairly high?
Thank you kindly for any thoughts and input. Again, I am asking for your OPINIONS based on the above. With such little compression at 1080p is there any necessity to increase the ref frames higher than the ref-1 that the preset calls for. I am only interested in whether you feel the picture quality would be affected/improved enough to bother. I know the ref frames are primarily a factor of compression, so with such little compression will it matter visually?
Thanks!
Blue_MiSfit
27th February 2020, 07:01
This kind of tuning is just not usually necessary. The rule of thumb is good:
1) Use the slowest preset you can stand
2) Use a CRF value (or 2 pass VBR) that gives you a suitable balance between size and quality
If you do tune anything, tune the psychovisual options for your source.
Asmodian
7th March 2020, 10:10
I agree, use a slower preset rather than tweak veryfast a lot. Unless you can handle something a bit slower but still need faster than the next preset down? You are already slowing veryfast down to enable psy and trellis, I would increase ref to 2 before doing your tweaks. Maybe you should simply switch to the fast preset?
The amount of compression does not significantly change the way settings trade speed for quality. Using only one ref while using subme 6 doesn't make a lot of sense, another ref would offer a better quality for speed tradeoff. Remember the original video is not 25 Gigs, it is 250 Gigs per hour (assuming 8 bit 1920x1080p24). The original bluray is already very compressed and the first step when re-encoding is to uncompress it.
benwaggoner
10th March 2020, 22:50
Reencoding to save ~15% file size seems pretty pointless to begin with. Better to just leave the video bitstream alone if possible.
Back when Doom9 was strapping and new, there were utilities that would reduce MPEG-2 encodes by 1-2 QP while preserving motion vectors, which was a pretty simple and very fast way to trim off up to maybe 20% in file size. Has anyone ever tried to do something similar for H.264?
For Blu-ray, there are a lot of restrictions on the bitstream. So if one didn't need to preserve BD player compatibility, I can see a system that would just reencode B and b frames to save bits, passing through IDR and P frames, taking advantage of non-hierarchical B-frames to save some bits.
Sharc
10th March 2020, 23:30
Reencoding to save ~15% file size seems pretty pointless to begin with. Better to just leave the video bitstream alone if possible.
The only reason I could see is to make the content fit a size constrained medium, eg a BD-25.
Back when Doom9 was strapping and new, there were utilities that would reduce MPEG-2 encodes by 1-2 QP while preserving motion vectors, which was a pretty simple and very fast way to trim off up to maybe 20% in file size. Has anyone ever tried to do something similar for H.264?
'DVD Shrink' or similar for H.264, you mean? Interesting thought.
benwaggoner
12th March 2020, 00:56
'DVD Shrink' or similar for H.264, you mean? Interesting thought.
Yeah. Same basic principal applies. And other tricks are available to H.264 encodes, like CAVLC to CABAC conversion. Reencoding just B and b frames would allow for messing with reference lists, maybe even increasing the number of reference frames.
Could be a fun project, but a lot of work and I don't know who would have the time or budget for it.
Stereodude
12th March 2020, 15:59
Yeah. Same basic principal applies. And other tricks are available to H.264 encodes, like CAVLC to CABAC conversion. Reencoding just B and b frames would allow for messing with reference lists, maybe even increasing the number of reference frames.
Could be a fun project, but a lot of work and I don't know who would have the time or budget for it.
But would the "DVD-shrink" method primarily save time or would the quality be better than a similar size full decode re-encode? Given how fast processors are now for H.264 is it worth the effort for just a speed gain (if that's all it is)? I mean my R9-3950X can do a blu-ray spec "veryslow" encode at 50+FPS (18Mbit/sec).
Sharc
12th March 2020, 21:02
But would the "DVD-shrink" method primarily save time or would the quality be better than a similar size full decode re-encode? Given how fast processors are now for H.264 is it worth the effort for just a speed gain (if that's all it is)? I mean my R9-3950X can do a blu-ray spec "veryslow" encode at 50+FPS (18Mbit/sec).
I always find it a bit doubtful or unfair when people take the encoding speed (cost of time, energy consumption ....) out of the equation and compare the visual quality of ultrafast methods (GPU, or maybe requant etc.) with slow or veryslow settings of current CPU methods just to find out that the latter is superior. But of course I accept that the compromise between speed and visual quality is a personal decision ;).
The interesting aspect with the proposed alternatives is that one could possibly expect blazing encoding speeds without relying on expensive GPU (or CPU) hardware.
Just guessing, I would assume that for low compression the quality can be quite good (similar experience as with former DVD-Shrink). Unfortunately I don't have the skills to develop such solutions.
Stereodude
13th March 2020, 04:03
I always find it a bit doubtful or unfair when people take the encoding speed (cost of time, energy consumption ....) out of the equation and compare the visual quality of ultrafast methods (GPU, or maybe requant etc.) with slow or veryslow settings of current CPU methods just to find out that the latter is superior. But of course I accept that the compromise between speed and visual quality is a personal decision ;).
The interesting aspect with the proposed alternatives is that one could possibly expect blazing encoding speeds without relying on expensive GPU (or CPU) hardware.
Just guessing, I would assume that for low compression the quality can be quite good (similar experience as with former DVD-Shrink). Unfortunately I don't have the skills to develop such solutions.
Well, my experience was that re-encoding MPEG-2 content didn't look good. Some of the programs that messed with the stream gave visibly better results and were very fast. I didn't think DVD Shrink gave very good results. DVD2One, specifically 1.5.x gave much better looking results.
Hence my question about trying the same thing on H.264.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.