diff options
-rw-r--r-- | gtk/src/standard_presets.xml | 460 | ||||
-rwxr-xr-x | scripts/manicure.rb | 108 | ||||
-rw-r--r-- | test/test.c | 310 |
3 files changed, 437 insertions, 441 deletions
diff --git a/gtk/src/standard_presets.xml b/gtk/src/standard_presets.xml index dbdebcc05..5582893eb 100644 --- a/gtk/src/standard_presets.xml +++ b/gtk/src/standard_presets.xml @@ -65,6 +65,8 @@ <integer>0</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> <integer>2</integer> <key>PictureRightCrop</key> @@ -92,9 +94,9 @@ <key>VideoEncoder</key> <string>H.264 (x264)</string> <key>VideoFramerate</key> - <string>Same as source</string> + <string>30</string> <key>VideoFramerateMode</key> - <string>vfr</string> + <string>pfr</string> <key>VideoGrayScale</key> <integer>0</integer> <key>VideoQualitySlider</key> @@ -103,8 +105,20 @@ <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>3.0</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> - <string>cabac=0:ref=2:me=umh:bframes=0:weightp=0:8x8dct=0:trellis=0:subme=6</string> + <string>level=3.0:ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:subme=6:vbv-bufsize=10000:vbv-maxrate=10000:rc-lookahead=30</string> + <key>x264OptionExtra</key> + <string></string> + <key>x264Preset</key> + <string>fast</string> + <key>h264Profile</key> + <string>baseline</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -150,6 +164,8 @@ <integer>1</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> <integer>0</integer> <key>PictureRightCrop</key> @@ -177,102 +193,31 @@ <key>VideoEncoder</key> <string>H.264 (x264)</string> <key>VideoFramerate</key> - <string>Same as source</string> - <key>VideoFramerateMode</key> - <string>vfr</string> - <key>VideoGrayScale</key> - <integer>0</integer> - <key>VideoQualityType</key> - <integer>1</integer> - <key>VideoTwoPass</key> - <integer>0</integer> - <key>x264Option</key> - <string>level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:subme=6:8x8dct=0:trellis=0</string> - </dict> - <dict> - <key>AudioList</key> - <array> - <dict> - <key>AudioBitrate</key> - <string>128</string> - <key>AudioEncoder</key> - <string>AAC (faac)</string> - <key>AudioMixdown</key> - <string>Dolby Pro Logic II</string> - <key>AudioSamplerate</key> - <string>Auto</string> - <key>AudioTrack</key> - <integer>1</integer> - <key>AudioTrackDRCSlider</key> - <real>0.0</real> - </dict> - </array> - <key>ChapterMarkers</key> - <integer>1</integer> - <key>Default</key> - <integer>0</integer> - <key>FileFormat</key> - <string>MP4 file</string> - <key>Mp4iPodCompatible</key> - <integer>0</integer> - <key>PictureAutoCrop</key> - <integer>1</integer> - <key>PictureBottomCrop</key> - <integer>0</integer> - <key>PictureDeblock</key> - <integer>0</integer> - <key>PictureDeinterlace</key> - <integer>0</integer> - <key>PictureDenoise</key> - <integer>0</integer> - <key>PictureDetelecine</key> - <integer>0</integer> - <key>PictureHeight</key> - <integer>0</integer> - <key>PictureKeepRatio</key> - <integer>1</integer> - <key>PictureLeftCrop</key> - <integer>0</integer> - <key>PicturePAR</key> - <integer>0</integer> - <key>PictureRightCrop</key> - <integer>0</integer> - <key>PictureTopCrop</key> - <integer>0</integer> - <key>PictureWidth</key> - <integer>480</integer> - <key>PresetDescription</key> - <string>HandBrake's settings for all iPhones and iPod Touches going back to the original iPhone 2G.</string> - <key>PresetName</key> - <string>iPhone & iPod Touch</string> - <key>Subtitles</key> - <string>None</string> - <key>Type</key> - <integer>0</integer> - <key>UsesPictureFilters</key> - <integer>1</integer> - <key>UsesPictureSettings</key> - <integer>1</integer> - <key>VFR</key> - <integer>0</integer> - <key>VideoAvgBitrate</key> - <string>960</string> - <key>VideoEncoder</key> - <string>H.264 (x264)</string> - <key>VideoFramerate</key> - <string>Same as source</string> + <string>30</string> <key>VideoFramerateMode</key> - <string>vfr</string> + <string>pfr</string> <key>VideoGrayScale</key> <integer>0</integer> <key>VideoQualitySlider</key> - <real>20</real> + <real>22</real> <key>VideoQualityType</key> <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>1.3</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> - <string>cabac=0:ref=2:me=umh:bframes=0:weightp=0:subme=6:8x8dct=0:trellis=0</string> + <string>level=1.3:ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:vbv-bufsize=2000:vbv-maxrate=768</string> + <key>x264OptionExtra</key> + <string></string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>baseline</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -320,6 +265,8 @@ <integer>0</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> <integer>2</integer> <key>PictureRightCrop</key> @@ -331,7 +278,7 @@ <key>PresetDescription</key> <string>HandBrake's preset for the iPhone 4 is optimized for viewing on its 960x480 display.</string> <key>PresetName</key> - <string>iPhone 4</string> + <string>iPhone & iPod Touch</string> <key>Subtitles</key> <string>None</string> <key>Type</key> @@ -353,13 +300,25 @@ <key>VideoGrayScale</key> <integer>0</integer> <key>VideoQualitySlider</key> - <real>20</real> + <real>22</real> <key>VideoQualityType</key> <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>3.1</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> + <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string> + <key>x264OptionExtra</key> <string></string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>high</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -407,6 +366,8 @@ <integer>0</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> <integer>2</integer> <key>PictureRightCrop</key> @@ -445,8 +406,20 @@ <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>3.1</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> + <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string> + <key>x264OptionExtra</key> <string></string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>high</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -508,6 +481,8 @@ <integer>0</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> <integer>2</integer> <key>PictureRightCrop</key> @@ -535,9 +510,9 @@ <key>VideoEncoder</key> <string>H.264 (x264)</string> <key>VideoFramerate</key> - <string>Same as source</string> + <string>30</string> <key>VideoFramerateMode</key> - <string>vfr</string> + <string>pfr</string> <key>VideoGrayScale</key> <integer>0</integer> <key>VideoQualitySlider</key> @@ -546,8 +521,20 @@ <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>3.1</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> - <string>cabac=0:ref=2:me=umh:b-pyramid=none:b-adapt=2:weightb=0:trellis=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500</string> + <string>cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500:level=3.1:8x8dct=0</string> + <key>x264OptionExtra</key> + <string>cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500</string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>main</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -609,6 +596,8 @@ <integer>0</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> <integer>2</integer> <key>PictureRightCrop</key> @@ -647,8 +636,20 @@ <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>3.1</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> + <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string> + <key>x264OptionExtra</key> <string></string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>high</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -752,8 +753,20 @@ <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>4.0</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> - <string>b-adapt=2</string> + <string>level=4.0:vbv-bufsize=31250:vbv-maxrate=25000</string> + <key>x264OptionExtra</key> + <string></string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>high</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -801,18 +814,20 @@ <integer>1</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> - <integer>0</integer> + <integer>2</integer> <key>PictureRightCrop</key> <integer>0</integer> <key>PictureTopCrop</key> <integer>0</integer> <key>PictureWidth</key> - <integer>480</integer> + <integer>720</integer> <key>PresetDescription</key> <string>HandBrake's settings for Mid-range Android 2.3 or better devices.</string> <key>PresetName</key> - <string>Android Mid</string> + <string>Android</string> <key>Subtitles</key> <string>None</string> <key>Type</key> @@ -839,8 +854,20 @@ <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>2.2</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> - <string>cabac=0:ref=2:me=umh:bframes=0:weightp=0:subme=6:8x8dct=0:trellis=0</string> + <string>level=2.2:ref=1:bframes=0:8x8dct=0:vbv-bufsize=4000:vbv-maxrate=4000</string> + <key>x264OptionExtra</key> + <string></string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>main</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -888,6 +915,8 @@ <integer>0</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> <integer>2</integer> <key>PictureRightCrop</key> @@ -895,11 +924,11 @@ <key>PictureTopCrop</key> <integer>0</integer> <key>PictureWidth</key> - <integer>720</integer> + <integer>1280</integer> <key>PresetDescription</key> <string>HandBrake's preset for the Higher end Anroid 2.3 or better devices.</string> <key>PresetName</key> - <string>Android High</string> + <string>Android Tablet</string> <key>Subtitles</key> <string>None</string> <key>Type</key> @@ -926,8 +955,20 @@ <integer>2</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>3.1</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> - <string>weightp=0:cabac=0</string> + <string>level=3.1:8x8dct=0:vbv-bufsize=14000:vbv-maxrate=14000</string> + <key>x264OptionExtra</key> + <string></string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>main</string> + <key>x264Tune</key> + <string>none</string> </dict> </array> <key>Default</key> @@ -986,8 +1027,10 @@ <integer>0</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> - <integer>1</integer> + <integer>2</integer> <key>PictureRightCrop</key> <integer>0</integer> <key>PictureTopCrop</key> @@ -1026,8 +1069,20 @@ <integer>0</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>4.0</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> - <string>ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0:8x8dct=0</string> + <string>level=4.0:ref=1:8x8dct=0:weightp=1:subme=2:mixed-refs=0:trellis=0:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=10</string> + <key>x264OptionExtra</key> + <string></string> + <key>x264Preset</key> + <string>veryfast</string> + <key>h264Profile</key> + <string>main</string> + <key>x264Tune</key> + <string>none</string> </dict> <dict> <key>AudioList</key> @@ -1091,6 +1146,8 @@ <integer>0</integer> <key>PictureLeftCrop</key> <integer>0</integer> + <key>PictureModulus</key> + <integer>2</integer> <key>PicturePAR</key> <integer>2</integer> <key>PictureRightCrop</key> @@ -1129,187 +1186,20 @@ <integer>0</integer> <key>VideoTwoPass</key> <integer>0</integer> + <key>h264Level</key> + <string>4.1</string> + <key>x264UseAdvancedOptions</key> + <false /> <key>x264Option</key> - <string>b-adapt=2:rc-lookahead=50</string> - </dict> - </array> - <key>Default</key> - <integer>0</integer> - <key>Folder</key> - <true/> - <key>PresetBuildNumber</key> - <integer>2012041101</integer> - <key>PresetName</key> - <string>Regular</string> - <key>Type</key> - <integer>0</integer> - </dict> - <dict> - <key>ChildrenArray</key> - <array> - <dict> - <key>AudioList</key> - <array> - <dict> - <key>AudioBitrate</key> - <string>160</string> - <key>AudioEncoder</key> - <string>AAC (faac)</string> - <key>AudioMixdown</key> - <string>Dolby Pro Logic II</string> - <key>AudioSamplerate</key> - <string>Auto</string> - <key>AudioTrack</key> - <integer>1</integer> - <key>AudioTrackDRCSlider</key> - <real>0.0</real> - </dict> - </array> - <key>ChapterMarkers</key> - <integer>0</integer> - <key>Default</key> - <integer>0</integer> - <key>FileFormat</key> - <string>MP4 file</string> - <key>PictureAutoCrop</key> - <integer>1</integer> - <key>PictureBottomCrop</key> - <integer>0</integer> - <key>PictureDeblock</key> - <integer>0</integer> - <key>PictureDeinterlace</key> - <integer>0</integer> - <key>PictureDenoise</key> - <integer>0</integer> - <key>PictureDetelecine</key> - <integer>0</integer> - <key>PictureHeight</key> - <integer>0</integer> - <key>PictureKeepRatio</key> - <integer>1</integer> - <key>PictureLeftCrop</key> - <integer>0</integer> - <key>PicturePAR</key> - <integer>0</integer> - <key>PictureRightCrop</key> - <integer>0</integer> - <key>PictureTopCrop</key> - <integer>0</integer> - <key>PictureWidth</key> - <integer>0</integer> - <key>PresetDescription</key> - <string>HandBrake's traditional, faster, lower-quality settings.</string> - <key>PresetName</key> - <string>Classic</string> - <key>Subtitles</key> - <string>None</string> - <key>Type</key> - <integer>0</integer> - <key>UsesPictureFilters</key> - <integer>1</integer> - <key>UsesPictureSettings</key> - <integer>2</integer> - <key>VFR</key> - <integer>0</integer> - <key>VideoAvgBitrate</key> - <string>1000</string> - <key>VideoEncoder</key> - <string>MPEG-4 (FFmpeg)</string> - <key>VideoFramerate</key> - <string>Same as source</string> - <key>VideoFramerateMode</key> - <string>vfr</string> - <key>VideoGrayScale</key> - <integer>0</integer> - <key>VideoQualityType</key> - <integer>1</integer> - <key>VideoTwoPass</key> - <integer>0</integer> - <key>x264Option</key> + <string>level=4.1:vbv-bufsize=78125:vbv-maxrate=62500</string> + <key>x264OptionExtra</key> <string></string> - </dict> - <dict> - <key>AudioList</key> - <array> - <dict> - <key>AudioBitrate</key> - <string>160</string> - <key>AudioEncoder</key> - <string>AAC (faac)</string> - <key>AudioMixdown</key> - <string>Dolby Pro Logic II</string> - <key>AudioSamplerate</key> - <string>Auto</string> - <key>AudioTrack</key> - <integer>1</integer> - <key>AudioTrackDRCSlider</key> - <real>0.0</real> - </dict> - </array> - <key>ChapterMarkers</key> - <integer>1</integer> - <key>Default</key> - <integer>0</integer> - <key>FileFormat</key> - <string>MP4 file</string> - <key>Mp4iPodCompatible</key> - <integer>1</integer> - <key>PictureAutoCrop</key> - <integer>1</integer> - <key>PictureBottomCrop</key> - <integer>0</integer> - <key>PictureDeblock</key> - <integer>0</integer> - <key>PictureDeinterlace</key> - <integer>0</integer> - <key>PictureDenoise</key> - <integer>0</integer> - <key>PictureDetelecine</key> - <integer>0</integer> - <key>PictureHeight</key> - <integer>0</integer> - <key>PictureKeepRatio</key> - <integer>1</integer> - <key>PictureLeftCrop</key> - <integer>0</integer> - <key>PicturePAR</key> - <integer>0</integer> - <key>PictureRightCrop</key> - <integer>0</integer> - <key>PictureTopCrop</key> - <integer>0</integer> - <key>PictureWidth</key> - <integer>640</integer> - <key>PresetDescription</key> - <string>HandBrake's high resolution settings for older 5 and 5.5G iPods. Good video quality, great for viewing on a TV using your iPod. This is the iPod High-Rez preset from 0.9.2.</string> - <key>PresetName</key> - <string>iPod Legacy</string> - <key>Subtitles</key> - <string>None</string> - <key>Type</key> - <integer>0</integer> - <key>UsesPictureFilters</key> - <integer>1</integer> - <key>UsesPictureSettings</key> - <integer>1</integer> - <key>VFR</key> - <integer>0</integer> - <key>VideoAvgBitrate</key> - <string>1500</string> - <key>VideoEncoder</key> - <string>H.264 (x264)</string> - <key>VideoFramerate</key> - <string>Same as source</string> - <key>VideoFramerateMode</key> - <string>vfr</string> - <key>VideoGrayScale</key> - <integer>0</integer> - <key>VideoQualityType</key> - <integer>1</integer> - <key>VideoTwoPass</key> - <integer>0</integer> - <key>x264Option</key> - <string>level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:psy-rd=0,0:subme=6:8x8dct=0:trellis=0</string> + <key>x264Preset</key> + <string>medium</string> + <key>h264Profile</key> + <string>high</string> + <key>x264Tune</key> + <string>none</string> </dict> </array> <key>Default</key> @@ -1319,7 +1209,7 @@ <key>PresetBuildNumber</key> <integer>2012041101</integer> <key>PresetName</key> - <string>Legacy</string> + <string>Regular</string> <key>Type</key> <integer>0</integer> </dict> diff --git a/scripts/manicure.rb b/scripts/manicure.rb index 7417a22f9..ae6346622 100755 --- a/scripts/manicure.rb +++ b/scripts/manicure.rb @@ -592,7 +592,27 @@ class Display if hash["VideoTurboTwoPass"] == 1 then commandString << " -T" end #Advanced Options - if hash["x264Option"] != "" + if hash["x264Preset"] != nil && hash["x264Preset"] != "" && hash["x264Preset"] != "custom" + commandString << " --x264-preset " + commandString << hash["x264Preset"] + + if hash["x264Tune"] != "" && hash["x264Tune"] != "none" + commandString << " --x264-tune " + commandString << hash["x264Tune"] + end + if hash["x264Profile"] != "" && hash["x264Profile"] != "auto" + commandString << " --x264-profile " + commandString << hash["x264Profile"] + end + if hash["x264Level"] != "" && hash["x264Level"] != "auto" + commandString << " --h264-level " + commandString << hash["x264Level"] + end + if hash["x264OptionExtra"] != "" + commandString << " -x " + commandString << hash["x264OptionExtra"] + end + elsif hash["x264Option"] != "" commandString << " -x " commandString << hash["x264Option"] end @@ -945,7 +965,27 @@ class Display if hash["VideoTurboTwoPass"] == 1 then commandString << " -T" end #Advanced Options - if hash["x264Option"] != "" + if hash["x264Preset"] != nil && hash["x264Preset"] != "" && hash["x264Preset"] != "custom" + commandString << " --x264-preset " + commandString << hash["x264Preset"] + + if hash["x264Tune"] != "" && hash["x264Tune"] != "none" + commandString << " --x264-tune " + commandString << hash["x264Tune"] + end + if hash["x264Profile"] != "" && hash["x264Profile"] != "auto" + commandString << " --x264-profile " + commandString << hash["x264Profile"] + end + if hash["x264Level"] != "" && hash["x264Level"] != "auto" + commandString << " --h264-level " + commandString << hash["x264Level"] + end + if hash["x264OptionExtra"] != "" + commandString << " -x " + commandString << hash["x264OptionExtra"] + end + elsif hash["x264Option"] != "" commandString << " -x " commandString << hash["x264Option"] end @@ -1223,8 +1263,44 @@ class Display end #Advanced Options - if hash["x264Option"] != "" - commandString << "if( !advanced_opts )\n " + if hash["x264Preset"] != nil && hash["x264Preset"] != "" && hash["x264Preset"] != "custom" + commandString << "if (x264_preset == NULL)\n " + commandString << "{\n " + commandString << " x264_preset = strdup(\"" + commandString << hash["x264Preset"] << "\");\n " + commandString << "}\n " + + if hash["x264Tune"] != "" && hash["x264Tune"] != "none" + commandString << "if (x264_tune == NULL)\n " + commandString << "{\n " + commandString << " x264_tune = strdup(\"" + commandString << hash["x264Tune"] + commandString << "\");\n " + commandString << "}\n " + end + if hash["x264Profile"] != "" && hash["x264Profile"] != "auto" + commandString << "if (x264_profile == NULL)\n " + commandString << "{\n " + commandString << " x264_profile = strdup(\"" + commandString << hash["x264Profile"] << "\");\n " + commandString << "}\n " + end + if hash["x264Level"] != "" && hash["x264Level"] != "auto" + commandString << "if (h264_level == NULL)\n " + commandString << "{\n " + commandString << " h264_level = strdup(\"" + commandString << hash["x264Level"] << "\");\n " + commandString << "}\n " + end + if hash["x264OptionExtra"] != "" + commandString << "if (advanced_opts == NULL)\n " + commandString << "{\n " + commandString << " advanced_opts = strdup(\"" + commandString << hash["x264OptionExtra"] << "\");\n " + commandString << "}\n " + end + elsif hash["x264Option"] != "" + commandString << "if (advanced_opts == NULL)\n " commandString << "{\n " commandString << " advanced_opts = strdup(\"" commandString << hash["x264Option"] << "\");\n " @@ -1690,10 +1766,30 @@ class Display if hash["VideoTurboTwoPass"] == 1 then commandString << " -T" end #Advanced Options - if hash["x264Option"] != "" + if hash["x264Preset"] != nil && hash["x264Preset"] != "" && hash["x264Preset"] != "custom" + commandString << " --x264-preset " + commandString << hash["x264Preset"] + + if hash["x264Tune"] != "" && hash["x264Tune"] != "none" + commandString << " --x264-tune " + commandString << hash["x264Tune"] + end + if hash["x264Profile"] != "" && hash["x264Profile"] != "auto" + commandString << " --x264-profile " + commandString << hash["x264Profile"] + end + if hash["x264Level"] != "" && hash["x264Level"] != "auto" + commandString << " --h264-level " + commandString << hash["x264Level"] + end + if hash["x264OptionExtra"] != "" + commandString << " -x " + commandString << hash["x264OptionExtra"] + end + elsif hash["x264Option"] != "" commandString << " -x " commandString << hash["x264Option"] - end + end commandString << "\\n\");" diff --git a/test/test.c b/test/test.c index 472fabd54..3b1d8f6df 100644 --- a/test/test.c +++ b/test/test.c @@ -706,6 +706,8 @@ static int HandleEvents( hb_handle_t * h ) } vcodec = HB_VCODEC_X264; job->vquality = 20.0; + job->vrate_base = 900000; + job->cfr = 2; if( !atracks ) { atracks = strdup("1,1"); @@ -731,14 +733,23 @@ static int HandleEvents( hb_handle_t * h ) dynamic_range_compression = strdup("0.0,0.0"); } maxWidth = 720; - if( !advanced_opts ) + if (x264_preset == NULL) + { + x264_preset = strdup("fast"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("baseline"); + } + if (h264_level == NULL) { - advanced_opts = strdup("cabac=0:ref=2:me=umh:bframes=0:weightp=0:8x8dct=0:trellis=0:subme=6"); + h264_level = strdup("3.0"); } if( !anamorphic_mode ) { anamorphic_mode = 2; } + modulus = 2; job->chapter_markers = 1; } if (!strcmp(preset_name, "iPod")) @@ -749,7 +760,9 @@ static int HandleEvents( hb_handle_t * h ) } job->ipod_atom = 1; vcodec = HB_VCODEC_X264; - job->vbitrate = 700; + job->vquality = 22.0; + job->vrate_base = 900000; + job->cfr = 2; if( !atracks ) { atracks = strdup("1"); @@ -775,52 +788,22 @@ static int HandleEvents( hb_handle_t * h ) dynamic_range_compression = strdup("0.0"); } maxWidth = 320; - if( !advanced_opts ) - { - advanced_opts = strdup("level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:subme=6:8x8dct=0:trellis=0"); - } - job->chapter_markers = 1; - } - if (!strcmp(preset_name, "iPhone & iPod Touch")) - { - if( !mux ) - { - mux = HB_MUX_MP4; - } - vcodec = HB_VCODEC_X264; - job->vquality = 20.0; - if( !atracks ) - { - atracks = strdup("1"); - } - if( !acodecs ) - { - acodecs = strdup("faac"); - } - if( !abitrates ) - { - abitrates = str_split("128", ','); - } - if( !mixdowns ) + if (x264_preset == NULL) { - mixdowns = strdup("dpl2"); + x264_preset = strdup("medium"); } - if( !arates ) + if (x264_profile == NULL) { - arates = strdup("Auto"); + x264_profile = strdup("baseline"); } - if( !dynamic_range_compression ) + if (h264_level == NULL) { - dynamic_range_compression = strdup("0.0"); - } - maxWidth = 480; - if( !advanced_opts ) - { - advanced_opts = strdup("cabac=0:ref=2:me=umh:bframes=0:weightp=0:subme=6:8x8dct=0:trellis=0"); + h264_level = strdup("1.3"); } + modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "iPhone 4")) + if (!strcmp(preset_name, "iPhone & iPod Touch")) { if( !mux ) { @@ -828,7 +811,7 @@ static int HandleEvents( hb_handle_t * h ) } job->largeFileSize = 1; vcodec = HB_VCODEC_X264; - job->vquality = 20.0; + job->vquality = 22.0; job->vrate_base = 900900; job->cfr = 2; if( !atracks ) @@ -856,10 +839,23 @@ static int HandleEvents( hb_handle_t * h ) dynamic_range_compression = strdup("0.0"); } maxWidth = 960; + if (x264_preset == NULL) + { + x264_preset = strdup("medium"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("high"); + } + if (h264_level == NULL) + { + h264_level = strdup("3.1"); + } if( !anamorphic_mode ) { anamorphic_mode = 2; } + modulus = 2; job->chapter_markers = 1; } if (!strcmp(preset_name, "iPad")) @@ -898,10 +894,23 @@ static int HandleEvents( hb_handle_t * h ) dynamic_range_compression = strdup("0.0"); } maxWidth = 1280; + if (x264_preset == NULL) + { + x264_preset = strdup("medium"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("high"); + } + if (h264_level == NULL) + { + h264_level = strdup("3.1"); + } if( !anamorphic_mode ) { anamorphic_mode = 2; } + modulus = 2; job->chapter_markers = 1; } if (!strcmp(preset_name, "AppleTV")) @@ -913,6 +922,8 @@ static int HandleEvents( hb_handle_t * h ) job->largeFileSize = 1; vcodec = HB_VCODEC_X264; job->vquality = 20.0; + job->vrate_base = 900000; + job->cfr = 2; if( !atracks ) { atracks = strdup("1,1"); @@ -938,14 +949,27 @@ static int HandleEvents( hb_handle_t * h ) dynamic_range_compression = strdup("0.0,0.0"); } maxWidth = 960; - if( !advanced_opts ) + if (x264_preset == NULL) + { + x264_preset = strdup("medium"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("main"); + } + if (h264_level == NULL) { - advanced_opts = strdup("cabac=0:ref=2:me=umh:b-pyramid=none:b-adapt=2:weightb=0:trellis=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500"); + h264_level = strdup("3.1"); + } + if (advanced_opts == NULL) + { + advanced_opts = strdup("cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500"); } if( !anamorphic_mode ) { anamorphic_mode = 2; } + modulus = 2; job->chapter_markers = 1; } if (!strcmp(preset_name, "AppleTV 2")) @@ -984,10 +1008,23 @@ static int HandleEvents( hb_handle_t * h ) dynamic_range_compression = strdup("0.0,0.0"); } maxWidth = 1280; + if (x264_preset == NULL) + { + x264_preset = strdup("medium"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("high"); + } + if (h264_level == NULL) + { + h264_level = strdup("3.1"); + } if( !anamorphic_mode ) { anamorphic_mode = 2; } + modulus = 2; job->chapter_markers = 1; } if (!strcmp(preset_name, "AppleTV 3")) @@ -1026,9 +1063,17 @@ static int HandleEvents( hb_handle_t * h ) dynamic_range_compression = strdup("0.0,0.0"); } maxWidth = 1920; - if( !advanced_opts ) + if (x264_preset == NULL) { - advanced_opts = strdup("b-adapt=2"); + x264_preset = strdup("medium"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("high"); + } + if (h264_level == NULL) + { + h264_level = strdup("4.0"); } decomb = 1; decomb_opt = "7:2:6:9:1:80"; @@ -1039,7 +1084,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "Android Mid")) + if (!strcmp(preset_name, "Android")) { if( !mux ) { @@ -1073,13 +1118,26 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } - maxWidth = 480; - if( !advanced_opts ) + maxWidth = 720; + if (x264_preset == NULL) + { + x264_preset = strdup("medium"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("main"); + } + if (h264_level == NULL) { - advanced_opts = strdup("cabac=0:ref=2:me=umh:bframes=0:weightp=0:subme=6:8x8dct=0:trellis=0"); + h264_level = strdup("2.2"); } + if( !anamorphic_mode ) + { + anamorphic_mode = 2; + } + modulus = 2; } - if (!strcmp(preset_name, "Android High")) + if (!strcmp(preset_name, "Android Tablet")) { if( !mux ) { @@ -1113,15 +1171,24 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } - maxWidth = 720; - if( !advanced_opts ) + maxWidth = 1280; + if (x264_preset == NULL) { - advanced_opts = strdup("weightp=0:cabac=0"); + x264_preset = strdup("medium"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("main"); + } + if (h264_level == NULL) + { + h264_level = strdup("3.1"); } if( !anamorphic_mode ) { anamorphic_mode = 2; } + modulus = 2; } if (!strcmp(preset_name, "Normal")) { @@ -1155,14 +1222,23 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } - if( !advanced_opts ) + if (x264_preset == NULL) + { + x264_preset = strdup("veryfast"); + } + if (x264_profile == NULL) + { + x264_profile = strdup("main"); + } + if (h264_level == NULL) { - advanced_opts = strdup("ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0:8x8dct=0"); + h264_level = strdup("4.0"); } if( !anamorphic_mode ) { - anamorphic_mode = 1; + anamorphic_mode = 2; } + modulus = 2; job->chapter_markers = 1; } if (!strcmp(preset_name, "High Profile")) @@ -1198,87 +1274,24 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0,0.0"); } - if( !advanced_opts ) - { - advanced_opts = strdup("b-adapt=2:rc-lookahead=50"); - } - decomb = 1; - if( !anamorphic_mode ) - { - anamorphic_mode = 2; - } - job->chapter_markers = 1; - } - if (!strcmp(preset_name, "Classic")) - { - if( !mux ) - { - mux = HB_MUX_MP4; - } - job->vbitrate = 1000; - if( !atracks ) - { - atracks = strdup("1"); - } - if( !acodecs ) - { - acodecs = strdup("faac"); - } - if( !abitrates ) - { - abitrates = str_split("160", ','); - } - if( !mixdowns ) - { - mixdowns = strdup("dpl2"); - } - if( !arates ) - { - arates = strdup("Auto"); - } - if( !dynamic_range_compression ) - { - dynamic_range_compression = strdup("0.0"); - } - } - if (!strcmp(preset_name, "iPod Legacy")) - { - if( !mux ) + if (x264_preset == NULL) { - mux = HB_MUX_MP4; + x264_preset = strdup("medium"); } - job->ipod_atom = 1; - vcodec = HB_VCODEC_X264; - job->vbitrate = 1500; - if( !atracks ) + if (x264_profile == NULL) { - atracks = strdup("1"); + x264_profile = strdup("high"); } - if( !acodecs ) + if (h264_level == NULL) { - acodecs = strdup("faac"); + h264_level = strdup("4.1"); } - if( !abitrates ) - { - abitrates = str_split("160", ','); - } - if( !mixdowns ) - { - mixdowns = strdup("dpl2"); - } - if( !arates ) - { - arates = strdup("Auto"); - } - if( !dynamic_range_compression ) - { - dynamic_range_compression = strdup("0.0"); - } - maxWidth = 640; - if( !advanced_opts ) + decomb = 1; + if( !anamorphic_mode ) { - advanced_opts = strdup("level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:psy-rd=0,0:subme=6:8x8dct=0:trellis=0"); + anamorphic_mode = 2; } + modulus = 2; job->chapter_markers = 1; } } @@ -2447,10 +2460,11 @@ static int HandleEvents( hb_handle_t * h ) job->color_matrix_code = color_matrix_code; } - job->x264_profile = x264_profile; - job->x264_preset = x264_preset; - job->x264_tune = x264_tune; - job->h264_level = h264_level; + hb_job_set_x264_preset(job, x264_preset); + hb_job_set_x264_tune(job, x264_tune); + hb_job_set_x264_profile(job, x264_profile); + hb_job_set_x264_level(job, h264_level); + if (maxWidth) job->maxWidth = maxWidth; if (maxHeight) @@ -3053,24 +3067,19 @@ static void ShowPresets() fprintf( stderr, "%s - %s - %s\n", HB_PROJECT_TITLE, HB_PROJECT_BUILD_TITLE, HB_PROJECT_URL_WEBSITE ); printf("\n< Devices\n"); - printf("\n + Universal: -e x264 -q 20.0 -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -X 720 --loose-anamorphic -m -x cabac=0:ref=2:me=umh:bframes=0:weightp=0:8x8dct=0:trellis=0:subme=6\n"); - printf("\n + iPod: -e x264 -b 700 -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -I -X 320 -m -x level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:subme=6:8x8dct=0:trellis=0\n"); - printf("\n + iPhone & iPod Touch: -e x264 -q 20.0 -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 -f mp4 -X 480 -m -x cabac=0:ref=2:me=umh:bframes=0:weightp=0:subme=6:8x8dct=0:trellis=0\n"); - printf("\n + iPhone 4: -e x264 -q 20.0 -r 29.97 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -4 -X 960 --loose-anamorphic -m\n"); - printf("\n + iPad: -e x264 -q 20.0 -r 29.97 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -4 -X 1280 --loose-anamorphic -m\n"); - printf("\n + AppleTV: -e x264 -q 20.0 -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 960 --loose-anamorphic -m -x cabac=0:ref=2:me=umh:b-pyramid=none:b-adapt=2:weightb=0:trellis=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500\n"); - printf("\n + AppleTV 2: -e x264 -q 20.0 -r 29.97 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 1280 --loose-anamorphic -m\n"); - printf("\n + AppleTV 3: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 1920 --decomb=fast --loose-anamorphic --modulus 2 -m -x b-adapt=2\n"); - printf("\n + Android Mid: -e x264 -q 22.0 -r 29.97 --pfr -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 -f mp4 -X 480 -x cabac=0:ref=2:me=umh:bframes=0:weightp=0:subme=6:8x8dct=0:trellis=0\n"); - printf("\n + Android High: -e x264 -q 22.0 -r 29.97 --pfr -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 -f mp4 -X 720 --loose-anamorphic -x weightp=0:cabac=0\n"); + printf("\n + Universal: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -X 720 --loose-anamorphic --modulus 2 -m --x264-preset fast --x264-profile baseline --h264-level 3.0\n"); + printf("\n + iPod: -e x264 -q 22.0 -r 30 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -I -X 320 --modulus 2 -m --x264-preset medium --x264-profile baseline --h264-level 1.3\n"); + printf("\n + iPhone & iPod Touch: -e x264 -q 22.0 -r 29.97 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -4 -X 960 --loose-anamorphic --modulus 2 -m --x264-preset medium --x264-profile high --h264-level 3.1\n"); + printf("\n + iPad: -e x264 -q 20.0 -r 29.97 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -4 -X 1280 --loose-anamorphic --modulus 2 -m --x264-preset medium --x264-profile high --h264-level 3.1\n"); + printf("\n + AppleTV: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 960 --loose-anamorphic --modulus 2 -m --x264-preset medium --x264-profile main --h264-level 3.1 -x cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500\n"); + printf("\n + AppleTV 2: -e x264 -q 20.0 -r 29.97 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 1280 --loose-anamorphic --modulus 2 -m --x264-preset medium --x264-profile high --h264-level 3.1\n"); + printf("\n + AppleTV 3: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 1920 --decomb=fast --loose-anamorphic --modulus 2 -m --x264-preset medium --x264-profile high --h264-level 4.0\n"); + printf("\n + Android: -e x264 -q 22.0 -r 29.97 --pfr -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 -f mp4 -X 720 --loose-anamorphic --modulus 2 --x264-preset medium --x264-profile main --h264-level 2.2\n"); + printf("\n + Android Tablet: -e x264 -q 22.0 -r 29.97 --pfr -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 -f mp4 -X 1280 --loose-anamorphic --modulus 2 --x264-preset medium --x264-profile main --h264-level 3.1\n"); printf("\n>\n"); printf("\n< Regular\n"); - printf("\n + Normal: -e x264 -q 20.0 -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 --strict-anamorphic -m -x ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0:8x8dct=0\n"); - printf("\n + High Profile: -e x264 -q 20.0 -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 --decomb --loose-anamorphic -m -x b-adapt=2:rc-lookahead=50\n"); - printf("\n>\n"); - printf("\n< Legacy\n"); - printf("\n + Classic: -b 1000 -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4\n"); - printf("\n + iPod Legacy: -e x264 -b 1500 -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -I -X 640 -m -x level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:psy-rd=0,0:subme=6:8x8dct=0:trellis=0\n"); + printf("\n + Normal: -e x264 -q 20.0 -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 --loose-anamorphic --modulus 2 -m --x264-preset veryfast --x264-profile main --h264-level 4.0\n"); + printf("\n + High Profile: -e x264 -q 20.0 -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 --decomb --loose-anamorphic --modulus 2 -m --x264-preset medium --x264-profile high --h264-level 4.1\n"); printf("\n>\n"); } @@ -3261,6 +3270,7 @@ static int ParseOptions( int argc, char ** argv ) { "arate", required_argument, NULL, 'R' }, { "encopts", required_argument, NULL, 'x' }, { "x264-profile", required_argument, NULL, X264_PROFILE }, + { "h264-profile", required_argument, NULL, X264_PROFILE }, { "x264-preset", required_argument, NULL, X264_PRESET }, { "x264-tune", required_argument, NULL, X264_TUNE }, { "h264-level", required_argument, NULL, H264_LEVEL }, |