anonmous
2nd November 2012, 15:10
Hi,
Like most who come into these forums, I am looking to maximize the quality to size ratio for some video footage I have using the x264 codec. I started off with a 347 Mb/s source file which came from Fraps. I plan on using this footage and others in some compositing projects that I hope to get to sooner than later, so I want to keep the quality of the footage as high as possible, but, as is usual, with the least space footprint.
Through various experiments, I’ve found that using the ‘Very slow’ preset within TMPGEnc Video Mastering Works 5.3.1.85, that very fine detail is maintained all the way down to a one-pass VBR (Average bitrate) with the bitrate set to 30,000 kb/s and a maximum bitrate of 34,000 kb/s (I will abbreviate this type of average/maximum bitrate from here on out as 30-34 Mb/s). Quite frankly, to my mind, this is nothing short of amazing: a 10-fold decrease in size with no apparent loss in quality. If I go any lower than this, certain details which are 2x2 pixels, 1x3 pixels, etc., tend to disappear.
I have set up a project within Adobe Premiere CS6 in which I compare 25 different frames from two different encodes. The first sequence is what I refer to as the ‘reference’ sequence, and the second is what I call the ‘current’ sequence. I initially started with an encode at 60-64 Mb/s. The 60-64 Mb/s encode when compared with the original 347 Mb/s file, showed no difference of any consequence in any of the 25 different frames being compared. I then kept reducing the bitrate until I found that dropping below 30-34 Mb/s showed a drop in detail in more than half of the 25 frames being compared. After that, I dropped the bitrate down to 20 Mb/s and started experimenting with the so-called ‘advanced’ settings. I also set up the comparative sequences so that I could apply the Difference blending mode to the reference and current sequences, so I would be able to see precisely where the two encodes differed.
As I changed each advanced setting, the resulting encode would become the ‘current’ sequence and throughout all of the advanced settings experiments, the ‘reference’ sequence remained the 30-34 Mb/s encode. For each advanced setting change I would tabulate which of the frames in the ‘current’ encode had maintained their quality when compared to the ‘reference’ encode, and which had lost quality when compared to the ‘reference’ encode. Based on that, I would give the advanced setting being experimented with a thumbs up or thumbs down. I have tried at least 40 different encodes with a variety of settings, and no matter how high I crank the settings on the lower bitrate encodes, the detail in very fine detail largely disappears.
What follows are some of the settings I’ve experimented with and found to (in general) maintain more detail in the encode:
Setting modified value | original value
VBR (average bitrate) pass count 2 | 1
Max number of reference frames 4 | 3
P Picture relative quality 2x | 0 (Automatic)
Motion Search Type Hadamard Exhaustive | Uneven Multihex
Use fast P-Skip search Unchecked | Checked
Apply DCT decimation Unchecked | Checked
B Frame pyramid mode Strict | Disabled
Sub-pixel motion estimation mode 11 | 9
I’ve also tried combining some as well as all of the above settings, and none of them have been able to get a 20 Mb/s encode to be as detailed as the 30-34 Mb/s encode. So, ultimately what I’m looking for is this:
1. What is a recommended recipe of x264 settings which would have a good chance of maintaining detail which is visible at 30-34 Mb/s at a significantly reduced bitrate (i.e. settings which achieve the objective at 29-33 Mb/s would not be significant in my mind, but settings which achieve the objective in a 24-28 Mb/s encode would be a significant and relevant reduction in bitrate)? I welcome as many suggestions as possible here because it's easy for me to run a couple of encodes, drop them into sub-sequences in Premiere and have 25 different frame-by-frame comparison sequences pick up the changes automatically.
2. Also, is there a resource where I could get some definitive guidelines as to how to pick a maximum bitrate to correspond with an average bitrate (e.g. if I’m doing a VBR average bitrate encode, and my average bitrate is set to 10 Mb/s, what should my maximum bitrate be set to? What about for an encode with an average bitrate set to 20 Mb/s? etc.).
For the source file, MediaInfo yields the following:
Format : Fraps
Codec ID : FPS1
Duration : 7mn 28s
Bit rate : 347 Mbps
Width : 1920 pixels
Height : 1200 pixels
Display aspect ratio : 1.600
Frame rate : 30.000 fps
Color space : YUV
Bit depth : 8 bits
Bits/(Pixel*Frame) : 5.019
Stream size : 18.1 GiB (100%)
For the encoded file 30-34 Mb/s file which shows no relevant loss of quality, MediaInfo yields the following:
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 31s
Bit rate mode : Variable
Bit rate : 29.8 Mbps
Nominal bit rate : 0 bps
Maximum bit rate : 34.0 Mbps
Width : 1728 pixels
Height : 1080 pixels
Display aspect ratio : 1.600
Frame rate mode : Constant
Frame rate : 30.000 fps
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.533
Stream size : 326 MiB (100%)
Writing library : x264 core 124
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=2 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-4 / threads=12 / sliced_threads=0 / slices=1 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=2pass / mbtree=1 / bitrate=30000000 / ratetol=1.0 / qcomp=0.60 / qpmin=5 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=34000000 / vbv_bufsize=34000000 / nal_hrd=vbr / ip_ratio=1.40 / aq=1:1.00
Color primaries : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177
I’ve tried many different settings. I’ve run well over 50 different encodes at lower bitrates, but once I drop below 30-34 Mb/s, I lose the details spoken of. Now, although these encodes look absolutely fantastic when viewed as video, they don't maintain the type of frame-by-frame detail which I'm looking for. It very well could be that as in the realm of engines "there is no replacement for displacement", it is true in the realm of video quality "there is no replacement for bitrate." If so, no problem, I just want to feel reasonably confident that I've taken proper advantage of what x264 has to offer.
Thanks very much!
Matt
P.S. as the saying goes, a picture is worth a thousand words, so I've attached a few screen captures. In each set, the first is from the 60-64 Mb/s encode and the second is from the 30-34 Mb/s encode (I'm not sure if the pictures will appear in-line after this, but here's hoping):
Like most who come into these forums, I am looking to maximize the quality to size ratio for some video footage I have using the x264 codec. I started off with a 347 Mb/s source file which came from Fraps. I plan on using this footage and others in some compositing projects that I hope to get to sooner than later, so I want to keep the quality of the footage as high as possible, but, as is usual, with the least space footprint.
Through various experiments, I’ve found that using the ‘Very slow’ preset within TMPGEnc Video Mastering Works 5.3.1.85, that very fine detail is maintained all the way down to a one-pass VBR (Average bitrate) with the bitrate set to 30,000 kb/s and a maximum bitrate of 34,000 kb/s (I will abbreviate this type of average/maximum bitrate from here on out as 30-34 Mb/s). Quite frankly, to my mind, this is nothing short of amazing: a 10-fold decrease in size with no apparent loss in quality. If I go any lower than this, certain details which are 2x2 pixels, 1x3 pixels, etc., tend to disappear.
I have set up a project within Adobe Premiere CS6 in which I compare 25 different frames from two different encodes. The first sequence is what I refer to as the ‘reference’ sequence, and the second is what I call the ‘current’ sequence. I initially started with an encode at 60-64 Mb/s. The 60-64 Mb/s encode when compared with the original 347 Mb/s file, showed no difference of any consequence in any of the 25 different frames being compared. I then kept reducing the bitrate until I found that dropping below 30-34 Mb/s showed a drop in detail in more than half of the 25 frames being compared. After that, I dropped the bitrate down to 20 Mb/s and started experimenting with the so-called ‘advanced’ settings. I also set up the comparative sequences so that I could apply the Difference blending mode to the reference and current sequences, so I would be able to see precisely where the two encodes differed.
As I changed each advanced setting, the resulting encode would become the ‘current’ sequence and throughout all of the advanced settings experiments, the ‘reference’ sequence remained the 30-34 Mb/s encode. For each advanced setting change I would tabulate which of the frames in the ‘current’ encode had maintained their quality when compared to the ‘reference’ encode, and which had lost quality when compared to the ‘reference’ encode. Based on that, I would give the advanced setting being experimented with a thumbs up or thumbs down. I have tried at least 40 different encodes with a variety of settings, and no matter how high I crank the settings on the lower bitrate encodes, the detail in very fine detail largely disappears.
What follows are some of the settings I’ve experimented with and found to (in general) maintain more detail in the encode:
Setting modified value | original value
VBR (average bitrate) pass count 2 | 1
Max number of reference frames 4 | 3
P Picture relative quality 2x | 0 (Automatic)
Motion Search Type Hadamard Exhaustive | Uneven Multihex
Use fast P-Skip search Unchecked | Checked
Apply DCT decimation Unchecked | Checked
B Frame pyramid mode Strict | Disabled
Sub-pixel motion estimation mode 11 | 9
I’ve also tried combining some as well as all of the above settings, and none of them have been able to get a 20 Mb/s encode to be as detailed as the 30-34 Mb/s encode. So, ultimately what I’m looking for is this:
1. What is a recommended recipe of x264 settings which would have a good chance of maintaining detail which is visible at 30-34 Mb/s at a significantly reduced bitrate (i.e. settings which achieve the objective at 29-33 Mb/s would not be significant in my mind, but settings which achieve the objective in a 24-28 Mb/s encode would be a significant and relevant reduction in bitrate)? I welcome as many suggestions as possible here because it's easy for me to run a couple of encodes, drop them into sub-sequences in Premiere and have 25 different frame-by-frame comparison sequences pick up the changes automatically.
2. Also, is there a resource where I could get some definitive guidelines as to how to pick a maximum bitrate to correspond with an average bitrate (e.g. if I’m doing a VBR average bitrate encode, and my average bitrate is set to 10 Mb/s, what should my maximum bitrate be set to? What about for an encode with an average bitrate set to 20 Mb/s? etc.).
For the source file, MediaInfo yields the following:
Format : Fraps
Codec ID : FPS1
Duration : 7mn 28s
Bit rate : 347 Mbps
Width : 1920 pixels
Height : 1200 pixels
Display aspect ratio : 1.600
Frame rate : 30.000 fps
Color space : YUV
Bit depth : 8 bits
Bits/(Pixel*Frame) : 5.019
Stream size : 18.1 GiB (100%)
For the encoded file 30-34 Mb/s file which shows no relevant loss of quality, MediaInfo yields the following:
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 31s
Bit rate mode : Variable
Bit rate : 29.8 Mbps
Nominal bit rate : 0 bps
Maximum bit rate : 34.0 Mbps
Width : 1728 pixels
Height : 1080 pixels
Display aspect ratio : 1.600
Frame rate mode : Constant
Frame rate : 30.000 fps
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.533
Stream size : 326 MiB (100%)
Writing library : x264 core 124
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=2 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-4 / threads=12 / sliced_threads=0 / slices=1 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=2pass / mbtree=1 / bitrate=30000000 / ratetol=1.0 / qcomp=0.60 / qpmin=5 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=34000000 / vbv_bufsize=34000000 / nal_hrd=vbr / ip_ratio=1.40 / aq=1:1.00
Color primaries : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177
I’ve tried many different settings. I’ve run well over 50 different encodes at lower bitrates, but once I drop below 30-34 Mb/s, I lose the details spoken of. Now, although these encodes look absolutely fantastic when viewed as video, they don't maintain the type of frame-by-frame detail which I'm looking for. It very well could be that as in the realm of engines "there is no replacement for displacement", it is true in the realm of video quality "there is no replacement for bitrate." If so, no problem, I just want to feel reasonably confident that I've taken proper advantage of what x264 has to offer.
Thanks very much!
Matt
P.S. as the saying goes, a picture is worth a thousand words, so I've attached a few screen captures. In each set, the first is from the 60-64 Mb/s encode and the second is from the 30-34 Mb/s encode (I'm not sure if the pictures will appear in-line after this, but here's hoping):