[FFmpeg-devel] [PATCH] concatdec: Fix handling of H.264 in MP4 in case of "-auto_convert 0"
Andrey Utkin
andrey_utkin at fastmail.com
Mon Apr 25 21:05:07 CEST 2016
On Mon, Apr 25, 2016 at 04:35:03PM +0200, Nicolas George wrote:
> Thanks for sending it again. I find my version is simpler, and it is
> probably closer to what it will look like when migrating to the new API. If
> that is fine with you, I would like to push it.
Your patch breaks a particular usecase, however my patch handles it well.
$FFMPEG -f lavfi -i testsrc -t 1 -x264opts stitchable=1 -c:v libx264 -y /tmp/testsrc.mp4
echo -e "ffconcat version 1.0
file /tmp/testsrc.mp4
" > /tmp/test.mp4.concat
$FFMPEG -safe 0 -i /tmp/test.mp4.concat -c copy -y /tmp/concat.ts
# Adding BSF explicitly doesn't affect the result
# $FFMPEG -safe 0 -i /tmp/test.mp4.concat -bsf h264_mp4toannexb -c copy -y /tmp/concat.ts
ffmpeg version N-79633-g4c0d0ff Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5)
configuration: --disable-everything --prefix=/home/j/work/employers/pitneybowes/interval_transcoder/build --extra-libs='/home/j/work/employers/pitneybowes/interval_transcoder/build/lib/libx264.a /home/j/work/employers/pitneybowes/interval_transcoder/build/lib/libfreetype.a /home/j/work/employers/pitneybowes/interval_transcoder/build/lib/libfribidi.a' --extra-ldflags=-L/home/j/work/employers/pitneybowes/interval_transcoder/build --extra-cflags='-I/home/j/work/employers/pitneybowes/interval_transcoder/build/include -O3' --disable-debug --enable-static --enable-libfribidi --enable-libfreetype --enable-libx264 --enable-gpl --disable-doc --disable-libxcb --disable-xlib --disable-sdl --disable-lzma --disable-bzlib --enable-protocol=file --enable-protocol=pipe --enable-indev=lavfi --enable-muxer=mp4 --enable-muxer=hls --enable-muxer=segment --enable-muxer=mpegts --enable-muxer=mjpeg --enable-muxer=image2 --enable-muxer=matroska --enable-muxer=rawvideo --enable-demuxer=mov --enable-demuxer=hls --enable-demuxer=mpegts --enable-demuxer=mjpeg --enable-demuxer=mp3 --enable-demuxer=concat --enable-demuxer=image2 --enable-demuxer=matroska --enable-demuxer=rawvideo --enable-decoder=h264 --enable-decoder=mpeg4 --enable-decoder=mpeg2video --enable-decoder=aac --enable-decoder=mp2 --enable-decoder=mp3 --enable-decoder=mjpeg --enable-decoder=rawvideo --enable-decoder=pcm_f32le --enable-decoder=pcm_f64le --enable-decoder=pcm_s16le --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mjpeg --enable-parser=aac --enable-encoder=libx264 --enable-encoder=aac --enable-encoder=mjpeg --enable-encoder=mpeg4 --enable-encoder=rawvideo --enable-filter=scale --enable-filter=fps --enable-filter=drawtext --enable-filter=overlay --enable-filter=copy --enable-filter=crop --enable-filter=fade --enable-filter=testsrc --enable-filter=movie --enable-filter=amovie --enable-filter=setpts --enable-filter=asetpts --enable-filter=settb --enable-filter=asettb --enable-filter=concat --enable-filter=format --enable-filter=aformat --enable-filter=amix --enable-filter=aresample --enable-filter=null --enable-filter=nullsrc --enable-filter=nullsink --enable-filter=anull --enable-filter=anullsrc --enable-filter=anullsink --enable-filter=aevalsrc --enable-filter=loop --enable-filter=aloop --enable-filter=sendcmd --enable-filter=asendcmd --enable-filter=showinfo --enable-filter=volume --enable-filter=volumedetect --enable-filter=dynaudnorm --enable-filter=vflip --enable-filter=hflip --enable-filter=blend --enable-filter=pad --enable-filter=geq --enable-bsf=h264_mp4toannexb --enable-bsf=aac_adtstoasc --enable-bsf=dump_extradata --enable-bsf=remove_extradata
libavutil 55. 22.101 / 55. 22.101
libavcodec 57. 38.100 / 57. 38.100
libavformat 57. 34.103 / 57. 34.103
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 44.100 / 6. 44.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, lavfi, from 'testsrc':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x2efa080] using SAR=1/1
[libx264 @ 0x2efa080] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x2efa080] profile High 4:4:4 Predictive, level 1.3, 4:4:4 8-bit
[libx264 @ 0x2efa080] 264 - core 148 r2692 64f4e24 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 stitchable=1 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
[mp4 @ 0x2ef8a60] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to '/tmp/testsrc.mp4':
Metadata:
encoder : Lavf57.34.103
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv444p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 12800 tbn
Metadata:
encoder : Lavc57.38.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 25 fps=0.0 q=-1.0 Lsize= 9kB time=00:00:00.88 bitrate= 79.6kbits/s speed=10.9x
video:7kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 14.537848%
[libx264 @ 0x2efa080] frame I:1 Avg QP:19.51 size: 2846
[libx264 @ 0x2efa080] frame P:8 Avg QP:17.76 size: 372
[libx264 @ 0x2efa080] frame B:16 Avg QP:14.95 size: 71
[libx264 @ 0x2efa080] consecutive B-frames: 12.0% 0.0% 24.0% 64.0%
[libx264 @ 0x2efa080] mb I I16..4: 31.3% 41.7% 27.0%
[libx264 @ 0x2efa080] mb P I16..4: 1.4% 1.9% 0.5% P16..4: 8.7% 3.0% 2.0% 0.0% 0.0% skip:82.5%
[libx264 @ 0x2efa080] mb B I16..4: 0.3% 0.1% 0.0% B16..8: 5.1% 0.1% 0.0% direct: 0.2% skip:94.1% L0:51.0% L1:43.5% BI: 5.5%
[libx264 @ 0x2efa080] 8x8 transform intra:43.0% inter:52.5%
[libx264 @ 0x2efa080] coded y,u,v intra: 12.0% 10.9% 11.4% inter: 0.7% 0.9% 0.8%
[libx264 @ 0x2efa080] i16 v,h,dc,p: 67% 21% 3% 9%
[libx264 @ 0x2efa080] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 71% 6% 23% 0% 0% 0% 0% 0% 0%
[libx264 @ 0x2efa080] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 49% 28% 15% 2% 1% 1% 0% 2% 0%
[libx264 @ 0x2efa080] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x2efa080] ref P L0: 63.8% 6.6% 25.0% 4.6%
[libx264 @ 0x2efa080] ref B L0: 66.4% 28.7% 4.9%
[libx264 @ 0x2efa080] ref B L1: 97.6% 2.4%
[libx264 @ 0x2efa080] kb/s:55.58
ffmpeg version N-79633-g4c0d0ff Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5)
configuration: --disable-everything --prefix=/home/j/work/employers/pitneybowes/interval_transcoder/build --extra-libs='/home/j/work/employers/pitneybowes/interval_transcoder/build/lib/libx264.a /home/j/work/employers/pitneybowes/interval_transcoder/build/lib/libfreetype.a /home/j/work/employers/pitneybowes/interval_transcoder/build/lib/libfribidi.a' --extra-ldflags=-L/home/j/work/employers/pitneybowes/interval_transcoder/build --extra-cflags='-I/home/j/work/employers/pitneybowes/interval_transcoder/build/include -O3' --disable-debug --enable-static --enable-libfribidi --enable-libfreetype --enable-libx264 --enable-gpl --disable-doc --disable-libxcb --disable-xlib --disable-sdl --disable-lzma --disable-bzlib --enable-protocol=file --enable-protocol=pipe --enable-indev=lavfi --enable-muxer=mp4 --enable-muxer=hls --enable-muxer=segment --enable-muxer=mpegts --enable-muxer=mjpeg --enable-muxer=image2 --enable-muxer=matroska --enable-muxer=rawvideo --enable-demuxer=mov --enable-demuxer=hls --enable-demuxer=mpegts --enable-demuxer=mjpeg --enable-demuxer=mp3 --enable-demuxer=concat --enable-demuxer=image2 --enable-demuxer=matroska --enable-demuxer=rawvideo --enable-decoder=h264 --enable-decoder=mpeg4 --enable-decoder=mpeg2video --enable-decoder=aac --enable-decoder=mp2 --enable-decoder=mp3 --enable-decoder=mjpeg --enable-decoder=rawvideo --enable-decoder=pcm_f32le --enable-decoder=pcm_f64le --enable-decoder=pcm_s16le --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mjpeg --enable-parser=aac --enable-encoder=libx264 --enable-encoder=aac --enable-encoder=mjpeg --enable-encoder=mpeg4 --enable-encoder=rawvideo --enable-filter=scale --enable-filter=fps --enable-filter=drawtext --enable-filter=overlay --enable-filter=copy --enable-filter=crop --enable-filter=fade --enable-filter=testsrc --enable-filter=movie --enable-filter=amovie --enable-filter=setpts --enable-filter=asetpts --enable-filter=settb --enable-filter=asettb --enable-filter=concat --enable-filter=format --enable-filter=aformat --enable-filter=amix --enable-filter=aresample --enable-filter=null --enable-filter=nullsrc --enable-filter=nullsink --enable-filter=anull --enable-filter=anullsrc --enable-filter=anullsink --enable-filter=aevalsrc --enable-filter=loop --enable-filter=aloop --enable-filter=sendcmd --enable-filter=asendcmd --enable-filter=showinfo --enable-filter=volume --enable-filter=volumedetect --enable-filter=dynaudnorm --enable-filter=vflip --enable-filter=hflip --enable-filter=blend --enable-filter=pad --enable-filter=geq --enable-bsf=h264_mp4toannexb --enable-bsf=aac_adtstoasc --enable-bsf=dump_extradata --enable-bsf=remove_extradata
libavutil 55. 22.101 / 55. 22.101
libavcodec 57. 38.100 / 57. 38.100
libavformat 57. 34.103 / 57. 34.103
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 44.100 / 6. 44.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1a90b80] Auto-inserting h264_mp4toannexb bitstream filter
[h264 @ 0x1aa1000] no frame!
Last message repeated 8 times
[h264 @ 0x1aa1000] slice type 24 too large at 1
[h264 @ 0x1aa1000] decode_slice_header error
[h264 @ 0x1aa1000] no frame!
Last message repeated 10 times
[h264 @ 0x1aa1000] sps_id 24 out of range
[h264 @ 0x1aa1000] no frame!
Last message repeated 4 times
[concat @ 0x1a8fa20] decoding for stream 0 failed
Input #0, concat, from '/tmp/test.mp4.concat':
Duration: N/A, start: 0.000000, bitrate: 61 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 320x240 [SAR 1:1 DAR 4:3], 61 kb/s, 25 fps, 25 tbr, 12800 tbn
Metadata:
handler_name : VideoHandler
[mpegts @ 0x1aa4180] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mpegts, to '/tmp/concat.ts':
Metadata:
encoder : Lavf57.34.103
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv444p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 61 kb/s, 25 fps, 25 tbr, 90k tbn
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x1aa4180] H.264 bitstream malformed, no startcode found, use the video bitstream filter 'h264_mp4toannexb' to fix it ('-bsf:v h264_mp4toannexb' option with ffmpeg)
av_interleaved_write_frame(): Invalid data found when processing input
frame= 1 fps=0.0 q=-1.0 Lsize= 0kB time=-00:00:00.07 bitrate= -0.0kbits/s speed=N/A
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
More information about the ffmpeg-devel
mailing list