Opened 13 years ago
Closed 13 years ago
#448 closed defect (fixed)
libx264 preset's rc_lookahead value is overwritten
Reported by: | Andrew Wason | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Specifying -preset slow with libx264 should result in rc_lookahead of 50, instead it is 40.
In X264_init() x4->params.rc.i_lookahead is initialized to 50 by x264_param_default_preset() for the "slow" preset. But then later it is overwritten by avctx->rc_lookahead which is 40
This problem was introduced in commit d4b967131842e7c225e5f83cb82337d4474a0bb7 which added the rc_lookahead private option.
From a gdb session:
257 if (x4->preset || x4->tune) (gdb) 258 if (x264_param_default_preset(&x4->params, x4->preset, x4->tune) < 0) { (gdb) p x4->preset $7 = 0x14790c0 "slow" (gdb) n 263 if (avctx->level > 0) (gdb) p x4->params.rc.i_lookahead $8 = 50 [...] 335 if (avctx->rc_lookahead >= 0) (gdb) 336 x4->params.rc.i_lookahead = avctx->rc_lookahead; (gdb) 337 if (avctx->weighted_p_pred >= 0) (gdb) p x4->params.rc.i_lookahead $9 = 40
Full ffmpeg output:
ffmpeg -i /tmp/apollo11.mov -an -codec:v libx264 -preset:v slow -y /tmp/foo.mp4 ffmpeg version N-32420-g88fddd0, Copyright (c) 2000-2011 the FFmpeg developers built on Sep 9 2011 20:33:39 with gcc 4.4.3 configuration: --extra-cflags=-I/opt/motionbox/foundation/6.4.0/include --extra-ldflags=-L/opt/motionbox/foundation/6.4.0/lib --enable-libx264 --enable-gpl --enable-debug=gdb3 --disable-optimizations libavutil 51. 16. 0 / 51. 16. 0 libavcodec 53. 13. 0 / 53. 13. 0 libavformat 53. 12. 0 / 53. 12. 0 libavdevice 53. 3. 0 / 53. 3. 0 libavfilter 2. 39. 0 / 2. 39. 0 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x25d6780] max_analyze_duration 5000000 reached at 5000000 Seems stream 0 codec frame rate differs from container frame rate: 600.00 (600/1) -> 3.00 (3/1) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/apollo11.mov': Metadata: creation_time : 1998-01-05 21:59:31 Duration: 00:00:06.66, start: 0.000000, bitrate: 22 kb/s Stream #0.0(eng): Video: svq1 (SVQ1 / 0x31515653), yuv410p, 80x60, 13 kb/s, SAR 1:1 DAR 4:3, 3 fps, 3 tbr, 600 tbn, 600 tbc Metadata: creation_time : 1998-01-05 21:59:31 Stream #0.1(eng): Audio: qcelp (Qclp / 0x706C6351), 8000 Hz, 1 channels, flt Metadata: creation_time : 1998-01-05 21:59:31 Incompatible pixel format 'yuv410p' for codec 'libx264', auto-selecting format 'yuv420p' [buffer @ 0x25d1200] w:80 h:60 pixfmt:yuv410p tb:1/1000000 sar:1/1 sws_param: [buffersink @ 0x25d7ec0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out' [scale @ 0x25d8520] w:80 h:60 fmt:yuv410p -> w:80 h:60 fmt:yuv420p flags:0x4 [libx264 @ 0x25de5c0] using SAR=1/1 [libx264 @ 0x25de5c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 [libx264 @ 0x25de5c0] profile Main, level 1.0 [libx264 @ 0x25de5c0] 264 - core 116 mbox/4.3.1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x1:0x111 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 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=0 open_gop=0 weightp=2 keyint=250 keyint_min=3 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 Output #0, mp4, to '/tmp/foo.mp4': Metadata: creation_time : 1998-01-05 21:59:31 encoder : Lavf53.12.0 Stream #0.0(eng): Video: h264 (![0][0][0] / 0x0021), yuv420p, 80x60 [SAR 1:1 DAR 4:3], q=-1--1, 3 tbn, 3 tbc Metadata: creation_time : 1998-01-05 21:59:31 Stream mapping: Stream #0.0 -> #0.0 (svq1 -> libx264) Press [q] to stop, [?] for help frame= 20 fps= 0 q=21.0 Lsize= 16kB time=00:00:06.33 bitrate= 20.8kbits/s video:15kB audio:0kB global headers:0kB muxing overhead 7.083741% frame I:1 Avg QP:20.35 size: 867 [libx264 @ 0x25de5c0] frame P:9 Avg QP:22.59 size: 852 [libx264 @ 0x25de5c0] frame B:10 Avg QP:23.73 size: 611 [libx264 @ 0x25de5c0] consecutive B-frames: 15.0% 50.0% 15.0% 20.0% [libx264 @ 0x25de5c0] mb I I16..4: 15.0% 0.0% 85.0% [libx264 @ 0x25de5c0] mb P I16..4: 4.4% 0.0% 57.8% P16..4: 10.6% 11.7% 15.6% 0.0% 0.0% skip: 0.0% [libx264 @ 0x25de5c0] mb B I16..4: 0.0% 0.0% 37.5% B16..8: 18.0% 18.0% 19.6% direct: 6.5% skip: 0.5% L0:49.4% L1:27.2% BI:23.4% [libx264 @ 0x25de5c0] direct mvs spatial:0.0% temporal:100.0% [libx264 @ 0x25de5c0] coded y,uvDC,uvAC intra: 96.1% 94.7% 63.3% inter: 75.4% 92.2% 28.5% [libx264 @ 0x25de5c0] i16 v,h,dc,p: 0% 64% 18% 18% [libx264 @ 0x25de5c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 13% 11% 5% 6% 9% 6% 8% 10% [libx264 @ 0x25de5c0] i8c dc,h,v,p: 35% 18% 29% 17% [libx264 @ 0x25de5c0] Weighted P-Frames: Y:33.3% UV:22.2% [libx264 @ 0x25de5c0] ref P L0: 76.5% 8.8% 5.9% 5.9% 1.5% 1.5% [libx264 @ 0x25de5c0] ref B L0: 96.8% 2.4% 0.9% [libx264 @ 0x25de5c0] kb/s:17.57
Change History (2)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I suspect this has just been fixed (by you), please reopen if I am wrong.
Note:
See TracTickets
for help on using tickets.
It looks like other x264 preset options have the same issue, these options have their "slow" preset defaults changed due to the default value of avctx->flags2: