I want to create an FFmpeg preset file. If I run a sample command it shows the currently used presets

$ ffmpeg -i infile.mp4 outfile.mp4
[libx264 @ 0000000002a9a5c0] 264 - core 140 r2377 1ca7bb9 - H.264/MPEG-4 AVC codec
- Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 
me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 
chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 
qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

Now I take those values and create a preset file as specified in the documentation.

§ Preset files

However if I try to use that file it errors out

$ ffmpeg -i infile.mp4 -fpre settings.txt outfile.mp4
settings.txt: Invalid option or argument: 'cabac=1
', parsed as 'cabac' = '1'
  • Looks like the default preset medium was likely used. Why do you want to try to copy these? Why not just use the standard presets (and maybe the -tune option)? – llogan Dec 8 '13 at 21:50

When you specify options in preset files, those map to actual ffmpeg options, not the encoder options it prints when you look at the debug output.

For example, fast_pskip in x264 is called -fast-pskip in ffmpeg. Same for rc_lookahead which is called rc-lookahead. Have a look at ffmpeg -h full, section libx264 AVOptions for all possible options you can map directly.

For all others you want to use the -x264opts option and pass a list of key=value:key=value, for example:

ffmpeg -i input.mp4 -c:v libx264 -x264-params rc_lookahead=30:keyint=500 output.mp4

Note that there's rarely a point in manually configuring these options. Use the -preset option and choose one of the x264 presets if you want to keep it simple.

| improve this answer | |

You should use

coder = 1

instead of cabac = 1

See this post for other parameters in a preset file.

| improve this answer | |
  • To pass x264 options directly you need to use -x264opts. I don't know the documentation you refer to but it could be you are using x264 options. – Rajib Dec 8 '13 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.