[FFmpeg-user] can't use x264opts to set qpfile

wtfux wtfux.dev at googlemail.com
Wed Sep 19 14:57:55 CEST 2012


Hi,
I want to use x264's option --qpfile to make it insert IDR frames in some
places (chapters).
FFmpeg has this option: ‘-force_key_frames[:stream_specifier]
time[,time...] (output,per-stream)’ However it's based on time stamps and
I'd rather give the frame number directly.

> ‘x264opts options’
>    Allow to set any x264 option, see x264 –fullhelp for a list.
>    options is a list of key=value couples separated by ":".

Well it does *not* allow to set all x264 options, at least I can't set:
-x264opts "qpfile:frames.qp" (something like -x264opts "rc_lookahead=100"
however works, just qpfile doesn't)
> [libx264 @ 035144e0] bad option 'qpfile': 'frames.qp'

Using x264 directly, --qpfile frames.qp works easily:

> x264.exe --fullhelp | findstr qpfile
>       --qpfile <string>       Force frametypes and QPs for some or all
frames

Is there a reason why I can't set --qpfile with -x264opts? Both x264 and
libx264 are built from the same source.

Log:

ffmpeg started on 2012-09-19 at 14:25:16
Report written to "ffmpeg-20120919-142516.log"
Command line:
ffmpeg -report -i pan01.mkv -c:v libx264 -preset:v ultrafast -profile:v
high10 -tune:v animation -level:v 5.1 -crf:v 20 -threads 6 -x264opts
"qpfile=frames.qp" -codec:a libfdk_aac -flags:a +qscale -global_quality:a 4
-afterburner:a 1 pan01_reencode2.mkv
ffmpeg version git-2012-09-04-3b6e9cd Copyright (c) 2000-2012 the FFmpeg
developers
  built on Sep  6 2012 18:09:41 with gcc 4.7.1 (GCC)
  configuration: --pkg-config=pkg-config --prefix=/root/win32
--enable-memalign-hack --arch=x86 --target-os=mingw32
--cross-prefix=i686-w64-mingw32- --enable-libfaac --enable-libfdk-aac
--enable-libx264 --enable-gpl --enable-nonfree --enable-version3
--enable-avfilter --enable-avisynth
  libavutil      51. 70.100 / 51. 70.100
  libavcodec     54. 55.100 / 54. 55.100
  libavformat    54. 25.104 / 54. 25.104
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 15.103 /  3. 15.103
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[matroska,webm @ 0038db00] Format matroska,webm probed with size=2048 and
score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 0038db00] File position before avformat_find_stream_info()
is 860
[matroska,webm @ 0038db00] parser not found for codec pcm_s16le, packets or
times may be invalid.
[h264 @ 0038e260] no picture
[matroska,webm @ 0038db00] first_dts 126 not matching first dts NOPTS in que
[matroska,webm @ 0038db00] first_dts 126 not matching first dts NOPTS in que
[matroska,webm @ 0038db00] parser not found for codec pcm_s16le, packets or
times may be invalid.
[matroska,webm @ 0038db00] All info found
[matroska,webm @ 0038db00] File position after avformat_find_stream_info()
is 3346
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, matroska,webm, from 'pan01.mkv':
  Metadata:
    ENCODER         : Lavf54.6.100
  Duration: 00:23:41.17, start: 0.000000, bitrate: 34356 kb/s
    Stream #0:0, 4, 1/1000: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1
DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1, 1, 1/1000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536
kb/s (default)
Setting entry with key 'video_size' to value '1920x1080'
[buffer @ 0038ab20] Setting entry with key 'pix_fmt' to value '0'
[buffer @ 0038ab20] Setting entry with key 'time_base' to value '1/1000'
[buffer @ 0038ab20] Setting entry with key 'pixel_aspect' to value '1/1'
[buffer @ 0038ab20] Setting entry with key 'sws_param' to value 'flags=2'
[buffer @ 0038ab20] Setting entry with key 'frame_rate' to value
'24000/1001'
[graph 0 input from stream 0:0 @ 0038aac0] w:1920 h:1080 pixfmt:yuv420p
tb:1/1000 fr:24000/1001 sar:1/1 sws_param:flags=2
[format @ 0038aec0] auto-inserting filter 'auto-inserted scaler 0' between
the filter 'Parsed_null_0' and the filter 'format'
[auto-inserted scaler 0 @ 0038b7c0] picking yuv420p10le out of 3
ref:yuv420p alpha:0
[auto-inserted scaler 0 @ 0038b7c0] w:1920 h:1080 fmt:yuv420p sar:1/1 ->
w:1920 h:1080 fmt:yuv420p10le sar:1/1 flags:0x4
[abuffer @ 01544740] Setting entry with key 'time_base' to value '1/48000'
[abuffer @ 01544740] Setting entry with key 'sample_rate' to value '48000'
[abuffer @ 01544740] Setting entry with key 'sample_fmt' to value 's16'
[abuffer @ 01544740] Setting entry with key 'channel_layout' to value '0x3'
[graph 1 input from stream 0:1 @ 036be180] tb:1/48000 samplefmt:s16
samplerate:48000 chlayout:0x3
[aformat @ 01542bc0] Setting entry with key 'sample_fmts' to value 's16'
[aformat @ 01542bc0] Setting entry with key 'channel_layouts' to value
'0x4,0x3,0x7,0x107,0x37,0x3f'
[libx264 @ 035144e0] bad option 'qpfile': 'frames.qp'
Output #0, matroska, to 'pan01_reencode2.mkv':
  Metadata:
    ENCODER         : Lavf54.6.100
    Stream #0:0, 0, 1/90000: Video: h264, yuv420p10le, 1920x1080 [SAR 1:1
DAR 16:9], q=-1--1, 90k tbn, 23.98 tbc (default)
    Stream #0:1, 0, 1/90000: Audio: none, 48000 Hz, stereo, s16 (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (pcm_s16le -> libfdk_aac)
Error while opening encoder for output stream #0:0 - maybe incorrect
parameters such as bit_rate, rate, width or height
[AVIOContext @ 01548080] Statistics: 32768 bytes read, 0 seeks


More information about the ffmpeg-user mailing list