View Full Version : translator needed: x264 to ffmpeg script
BabaG
30th July 2019, 22:23
i've been using the scripting discussed here for a very long time:
https://forum.doom9.org/showthread.php?t=168857&highlight=babag
i'd like to have the option to use ffmpeg now rather than x264 encoder as i use ffmpeg more anyway. i'm just not up to figuring this out. here is the scripting for x264:x264 --bluray-compat --bitrate 22000 --preset veryslow --tune film --weightp 0 /
--bframes 3 --nal-hrd vbr --vbv-maxrate 40000 /
--vbv-bufsize 30000 --level 4.1 --fps 24000/1001 /
--keyint 24 --b-pyramid strict --slices 4 --aud /
--colorprim "bt709" --transfer "bt709" --colormatrix "bt709" /
--sar 1:1 --ref 4 --qpmin 4 --pass 1 -o output_file.264 /
input_16x9_ProResHQ.mov /
&& /
x264 --bluray-compat --bitrate 22000 --preset veryslow /
--tune film --weightp 0 --bframes 3 --nal-hrd vbr /
--vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 /
--fps 24000/1001 --keyint 24 --b-pyramid strict --slices 4 /
--aud --colorprim "bt709" --transfer "bt709" /
--colormatrix "bt709" --sar 1:1 --ref 4 --qpmin 4 --pass 2 /
-o output_file.264 input_16x9_ProResHQ.mov
can anyone translate this into ffmpeg?
thanks very much,
babag
Lypheo
1st August 2019, 13:56
You can use the -x264opts option in ffmpeg to pass a list of arbitrary parameters to x264. See the documentation for the exact syntax.
BabaG
1st August 2019, 17:40
thanks, lypheo. i found this on the ffmpeg site:Warning: Do not use the option x264opts, as it will eventually be removed. Use x264-params instead.don't really understand how this works. is this calling and using x264 software or is it just translating x264 commands so that ffmpeg can execute them?
thanks again,
babag
ChaosKing
1st August 2019, 18:00
I just googled it for you https://trac.ffmpeg.org/wiki/Encode/H.264
Example:
ffmpeg -i input -c:v libx264 -preset slow -crf 22 -x264-params keyint=123:min-keyint=20 -c:a copy output.mkv
Warning: Do not use the option x264opts, as it will eventually be removed. Use x264-params instead.
BabaG
1st August 2019, 18:22
thanks, chaosking. that's actually the same page i got the warning quote from.
the script i originally posted produces a .264 file that loads into adobe encore directly without encore requiring transcoding. from everything i read online, that's something of a problem as many scripts produce files that encore wants to transcode. for that reason, i feel like i want to try to replicate the posted script, using ffmpeg, as directly as possible. still don't quite understand the process, though. getting the idea that using something like 'x264-params' followed by my x264 options separated by colons would be the process but haven't yet found direct examples of more than a couple of scenarios, none as complex as the above script. still looking.
@chaosking are you suggesting, by posting the code in addition to the warning, that i should simply add all of my parameters, separated by colons, into the 'x264-params' part of that code? is that how it works?
also, do i have it right that x264 has in some way been folded into ffmpeg now and it's that included x264 code that's being called with the 'x264-params' switch?
thanks again,
babag
BabaG
1st August 2019, 19:03
ok, based on what i think i'm starting to see, here's a go at translating to ffmpeg:ffmpeg -i input_16x9_ProResHQ.mov -c:v libx264 /
-preset veryslow -crf 22 -x264-params bluray-compat: /
bitrate 22000:preset veryslow:tune film:weightp 0: /
bframes 3:nal-hrd vbr:vbv-maxrate 40000: /
vbv-bufsize 30000:level 4.1:fps 24000/1001: /
keyint 24:b-pyramid strict:slices 4:aud: /
colorprim "bt709":transfer "bt709":colormatrix "bt709": /
sar 1:1:ref 4:qpmin 4:pass 1 -o output_file.264 /
&& /
ffmpeg -i input_16x9_ProResHQ.mov -c:v libx264 /
-preset veryslow -crf 22 -x264-params bluray-compat: /
bitrate 22000:preset veryslow:tune film:weightp 0: /
bframes 3:nal-hrd vbr:vbv-maxrate 40000: /
vbv-bufsize 30000:level 4.1:fps 24000/1001: /
keyint 24:b-pyramid strict:slices 4:aud: /
colorprim "bt709":transfer "bt709":colormatrix "bt709": /
sar 1:1:ref 4:qpmin 4:pass 2 -o output_file.264 /the most questionable things i see are that i use the preset veryslow twice, and whether pass 1 and pass 2 should be part of the x264 call. i wasn't sure whether the veryslow call needed to be made for both ffmpeg as well as the x264 parameters or if just the ffmpeg was sufficient (or, maybe the x264 call is the one to use). there's probably plenty more but that's where i am with this now.
also wondering if any of the x264 parameters should be moved to native ffmpeg switches as there are so many x264 parameters being called. guidance on that is appreciated.
thanks for any corrections,
babag
smok3
2nd August 2019, 10:11
you can also check the file itself.
mediainfo file.mp4 | grep -i encoding
Encoding settings : cabac=1 / ref=5 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=hex ...
In this example I can tell that this is not 'veryslow' due to the fact that 'me=hex'.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.