Overlaying a transparent webm on an MP4 freezes at the start sometimes - ffmpeg

I'm currently using the command
ffmpeg -i mainvideo.mp4 -vcodec libvpx -i myoverlay.webm -filter_complex "overlay = 5:5" done.mp4
To overlay a transparent webm on top of my main mp4. But for some reason the output video is frozen for the first 1~ second but the audio is completely fine.
I've tried this command with other videos and it works sometimes but most of the time the first few frames seem frozen
Edit.
I have two main mp4 files, broken_source.mp4 and working_source.mp4. Putting the overlay on broken_source results in the output having the first 1~ second of video frozen (audio completely fine) but putting the same overlay on working_source.mp4 is perfect and has no issues
Logs for putting the overlay on working_source:
ffmpeg -i working_source.mp4 -vcodec libvpx -i chat.webm -filter_complex "overlay = 0:0" working_complete.mp4
ffmpeg version 4.3.1-2021-01-01-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'working_source.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.51.101
Duration: 00:00:31.02, start: 0.000000, bitrate: 6176 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 6035 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
[libvpx # 0000016fb5074a80] v1.9.0-128-g3a38edea2
Last message repeated 1 times
Input #1, matroska,webm, from 'chat.webm':
Metadata:
ENCODER : Lavf58.51.101
Duration: 00:00:31.00, start: 0.000000, bitrate: 449 kb/s
Stream #1:0: Video: vp8, yuva420p(tv, progressive), 500x300, SAR 1:1 DAR 5:3, 60 fps, 60 tbr, 1k tbn, 1k tbc (default)
Metadata:
alpha_mode : 1
ENCODER : Lavc58.101.101 libvpx
DURATION : 00:00:31.000000000
[libvpx # 0000016fb50761c0] v1.9.0-128-g3a38edea2
Stream mapping:
Stream #0:0 (h264) -> overlay:main (graph 0)
Stream #1:0 (libvpx) -> overlay:overlay (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libvpx # 0000016fb50761c0] v1.9.0-128-g3a38edea2
[libx264 # 0000016fb5072040] using SAR=1/1
[libx264 # 0000016fb5072040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0000016fb5072040] profile High, level 4.2, 4:2:0, 8-bit
[libx264 # 0000016fb5072040] 264 - core 161 r3027 4121277 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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
Output #0, mp4, to 'working_complete.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 60 fps, 15360 tbn, 60 tbc (default)
Metadata:
encoder : Lavc58.91.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.91.100 aac
frame= 1861 fps= 44 q=-1.0 Lsize= 20013kB time=00:00:31.01 bitrate=5285.3kbits/s speed=0.729x
video:19477kB audio:486kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.244893%
[libx264 # 0000016fb5072040] frame I:8 Avg QP:19.04 size:240534
[libx264 # 0000016fb5072040] frame P:538 Avg QP:23.76 size: 23836
[libx264 # 0000016fb5072040] frame B:1315 Avg QP:31.66 size: 3951
[libx264 # 0000016fb5072040] consecutive B-frames: 3.0% 3.5% 14.8% 78.7%
[libx264 # 0000016fb5072040] mb I I16..4: 6.4% 47.4% 46.2%
[libx264 # 0000016fb5072040] mb P I16..4: 1.2% 4.2% 1.9% P16..4: 21.4% 5.3% 2.9% 0.0% 0.0% skip:63.1%
[libx264 # 0000016fb5072040] mb B I16..4: 0.1% 0.2% 0.1% B16..8: 12.6% 1.5% 0.5% direct: 0.4% skip:84.6% L0:35.9% L1:60.0% BI: 4.1%
[libx264 # 0000016fb5072040] 8x8 transform intra:55.5% inter:60.0%
[libx264 # 0000016fb5072040] coded y,uvDC,uvAC intra: 63.5% 77.4% 40.4% inter: 3.7% 4.6% 0.7%
[libx264 # 0000016fb5072040] i16 v,h,dc,p: 19% 37% 15% 29%
[libx264 # 0000016fb5072040] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 18% 23% 7% 7% 7% 7% 6% 8%
[libx264 # 0000016fb5072040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 22% 17% 7% 8% 7% 7% 6% 6%
[libx264 # 0000016fb5072040] i8c dc,h,v,p: 45% 27% 18% 11%
[libx264 # 0000016fb5072040] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0000016fb5072040] ref P L0: 74.5% 13.9% 9.1% 2.5%
[libx264 # 0000016fb5072040] ref B L0: 91.9% 7.4% 0.7%
[libx264 # 0000016fb5072040] ref B L1: 96.6% 3.4%
[libx264 # 0000016fb5072040] kb/s:5144.05
[aac # 0000016fb5026a80] Qavg: 193.230
Logs for putting the overlay on broken_source:
ffmpeg -i broken_source.mp4 -vcodec libvpx -i chat.webm -filter_complex "overlay = 0:0" broken_complete.mp4
ffmpeg version 4.3.1-2021-01-01-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'broken_source.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.26.101
Duration: 00:00:45.02, start: 0.000000, bitrate: 5962 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 5952 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
[libvpx # 0000021071f90280] v1.9.0-128-g3a38edea2
Last message repeated 1 times
Input #1, matroska,webm, from 'chat.webm':
Metadata:
ENCODER : Lavf58.51.101
Duration: 00:00:31.00, start: 0.000000, bitrate: 449 kb/s
Stream #1:0: Video: vp8, yuva420p(tv, progressive), 500x300, SAR 1:1 DAR 5:3, 60 fps, 60 tbr, 1k tbn, 1k tbc (default)
Metadata:
alpha_mode : 1
ENCODER : Lavc58.101.101 libvpx
DURATION : 00:00:31.000000000
[libvpx # 0000021072020dc0] v1.9.0-128-g3a38edea2
Stream #0:0 (h264) -> overlay:main (graph 0)
Stream #1:0 (libvpx) -> overlay:overlay (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libvpx # 0000021072020dc0] v1.9.0-128-g3a38edea2
[libx264 # 0000021072022980] using SAR=1/1
[libx264 # 0000021072022980] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0000021072022980] profile High, level 4.2, 4:2:0, 8-bit
[libx264 # 0000021072022980] 264 - core 161 r3027 4121277 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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
Output #0, mp4, to 'broken_complete.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 60 fps, 15360 tbn, 60 tbc (default)
Metadata:
encoder : Lavc58.91.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.91.100 aac
frame= 2701 fps= 47 q=-1.0 Lsize= 23020kB time=00:00:45.01 bitrate=4189.5kbits/s dup=60 drop=0 speed=0.789x
video:22242kB audio:708kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.309473%
[libx264 # 0000021072022980] frame I:11 Avg QP:18.82 size:210832
[libx264 # 0000021072022980] frame P:742 Avg QP:23.14 size: 18106
[libx264 # 0000021072022980] frame B:1948 Avg QP:31.16 size: 3604
[libx264 # 0000021072022980] consecutive B-frames: 1.7% 4.2% 6.2% 87.8%
[libx264 # 0000021072022980] mb I I16..4: 10.0% 46.2% 43.7%
[libx264 # 0000021072022980] mb P I16..4: 1.6% 4.5% 1.5% P16..4: 16.5% 4.2% 2.4% 0.0% 0.0% skip:69.3%
[libx264 # 0000021072022980] mb B I16..4: 0.1% 0.3% 0.1% B16..8: 11.3% 1.4% 0.4% direct: 0.4% skip:86.0% L0:36.5% L1:59.3% BI: 4.3%
[libx264 # 0000021072022980] 8x8 transform intra:57.4% inter:64.8%
[libx264 # 0000021072022980] coded y,uvDC,uvAC intra: 55.4% 42.1% 14.8% inter: 3.3% 2.1% 0.3%
[libx264 # 0000021072022980] i16 v,h,dc,p: 21% 37% 15% 27%
[libx264 # 0000021072022980] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 18% 24% 6% 7% 6% 7% 6% 7%
[libx264 # 0000021072022980] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 22% 16% 7% 7% 7% 7% 6% 6%
[libx264 # 0000021072022980] i8c dc,h,v,p: 58% 22% 15% 5%
[libx264 # 0000021072022980] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0000021072022980] ref P L0: 68.9% 16.6% 10.8% 3.6%
[libx264 # 0000021072022980] ref B L0: 91.6% 7.2% 1.2%
[libx264 # 0000021072022980] ref B L1: 95.9% 4.1%
[libx264 # 0000021072022980] kb/s:4047.35
[aac # 0000021072024840] Qavg: 189.405

Related

FFMPEG - latest build doesn't work, earlier build does

I have been using FFMPEG to overlay coloured rectangles on a video. I updated FFMPEG and it no longer works. No error is issued, it just doesn't do the job - the resulting video is the same as the input video. Here's the script:
FFMpeg -y -i Input.mp4 -filter_complex \
"nullsrc=size=1920x1080, \
drawbox=x=200:y=100:w=300:h=150:t=20:c=yellow, fade=in:st=10:d=1:alpha=1, fade=out:st=20:d=2:alpha=1 [tmp1]; \
nullsrc=size=1920x1080, \
drawbox=x=240:y=140:w=300:h=150:t=20:c=red, fade=in:st=15:d=1:alpha=1, fade=out:st=25:d=2:alpha=1 [tmp2]; \
[tmp1][tmp2] overlay=0:0:shortest=1[tmp3]; \
[0:v][tmp3] overlay=0:0:shortest=1" \
Output.mp4
The output video should be the input video with a yellow rectangle added from T=10 to T=20 and a red rectangle from T=15 to T=25, fading them in and out.
The version that was working (3.4) was one that came with an ImageMagick installation. The version I updated it to was 4.2.3. I tried it on various other builds I had lying around and it only works with 3.4.
It seems unlikely that this is a regression so I haven't submitted a bug report. I figure it's more likely that I'm not doing something correctly and 3.4 is more lenient on its interpretation of my command.
Whatever, I prefer to be working with a current build, so I invite comments on what the reasons might be.
Console dump of 3.4 run
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:01:48.67, start: 0.000000, bitrate: 1693 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1562 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 (h264) -> overlay:main (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 000001f0d4a0e6a0] using SAR=1/1
[libx264 # 000001f0d4a0e6a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 000001f0d4a0e6a0] profile High, level 4.0
[libx264 # 000001f0d4a0e6a0] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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
Output #0, mp4, to 'Output-34.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.107.100 aac
frame= 3260 fps= 25 q=-1.0 Lsize= 21461kB time=00:01:48.56 bitrate=1619.3kbits/s speed=0.828x
video:19713kB audio:1634kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.534457%
[libx264 # 000001f0d4a0e6a0] frame I:14 Avg QP:17.68 size:208205
[libx264 # 000001f0d4a0e6a0] frame P:844 Avg QP:21.55 size: 16867
[libx264 # 000001f0d4a0e6a0] frame B:2402 Avg QP:28.40 size: 1263
[libx264 # 000001f0d4a0e6a0] consecutive B-frames: 0.7% 2.9% 0.4% 96.0%
[libx264 # 000001f0d4a0e6a0] mb I I16..4: 14.0% 39.6% 46.4%
[libx264 # 000001f0d4a0e6a0] mb P I16..4: 0.4% 0.7% 0.2% P16..4: 20.2% 9.1% 4.6% 0.0% 0.0% skip:64.8%
[libx264 # 000001f0d4a0e6a0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 12.4% 0.4% 0.1% direct: 0.1% skip:87.1% L0:42.9% L1:55.2% BI: 1.9%
[libx264 # 000001f0d4a0e6a0] 8x8 transform intra:45.2% inter:68.3%
[libx264 # 000001f0d4a0e6a0] coded y,uvDC,uvAC intra: 64.4% 81.6% 45.1% inter: 2.9% 4.2% 0.1%
[libx264 # 000001f0d4a0e6a0] i16 v,h,dc,p: 32% 26% 6% 37%
[libx264 # 000001f0d4a0e6a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 20% 15% 5% 6% 7% 7% 7% 8%
[libx264 # 000001f0d4a0e6a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 28% 8% 4% 6% 6% 6% 5% 5%
[libx264 # 000001f0d4a0e6a0] i8c dc,h,v,p: 37% 25% 28% 10%
[libx264 # 000001f0d4a0e6a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 000001f0d4a0e6a0] ref P L0: 70.4% 15.3% 10.8% 3.5%
[libx264 # 000001f0d4a0e6a0] ref B L0: 93.1% 6.0% 0.9%
[libx264 # 000001f0d4a0e6a0] ref B L1: 97.8% 2.2%
[libx264 # 000001f0d4a0e6a0] kb/s:1486.03
[aac # 000001f0d4a10a20] Qavg: 1586.609
And 4.2.3
ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200523
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:01:48.67, start: 0.000000, bitrate: 1693 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1562 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 (h264) -> overlay:main (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 000001e7b4531d40] using SAR=1/1
[libx264 # 000001e7b4531d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 000001e7b4531d40] profile High, level 4.0, 4:2:0, 8-bit
[libx264 # 000001e7b4531d40] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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
Output #0, mp4, to 'Output-423.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.54.100 aac
frame= 3260 fps= 28 q=-1.0 Lsize= 21425kB time=00:01:48.56 bitrate=1616.7kbits/s speed=0.917x
video:19686kB audio:1625kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.535352%
[libx264 # 000001e7b4531d40] frame I:14 Avg QP:17.68 size:208355
[libx264 # 000001e7b4531d40] frame P:844 Avg QP:21.54 size: 16838
[libx264 # 000001e7b4531d40] frame B:2402 Avg QP:28.43 size: 1261
[libx264 # 000001e7b4531d40] consecutive B-frames: 0.7% 2.9% 0.4% 96.0%
[libx264 # 000001e7b4531d40] mb I I16..4: 13.9% 39.7% 46.4%
[libx264 # 000001e7b4531d40] mb P I16..4: 0.4% 0.7% 0.2% P16..4: 20.2% 9.1% 4.6% 0.0% 0.0% skip:64.8%
[libx264 # 000001e7b4531d40] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 12.4% 0.4% 0.1% direct: 0.1% skip:87.1% L0:42.9% L1:55.2% BI: 1.9%
[libx264 # 000001e7b4531d40] 8x8 transform intra:45.3% inter:68.3%
[libx264 # 000001e7b4531d40] coded y,uvDC,uvAC intra: 65.2% 82.4% 45.8% inter: 2.9% 4.2% 0.1%
[libx264 # 000001e7b4531d40] i16 v,h,dc,p: 32% 24% 6% 38%
[libx264 # 000001e7b4531d40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 19% 14% 5% 6% 7% 7% 7% 8%
[libx264 # 000001e7b4531d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 28% 8% 4% 6% 6% 6% 5% 5%
[libx264 # 000001e7b4531d40] i8c dc,h,v,p: 37% 24% 28% 11%
[libx264 # 000001e7b4531d40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 000001e7b4531d40] ref P L0: 70.4% 15.3% 10.8% 3.5%
[libx264 # 000001e7b4531d40] ref B L0: 93.1% 6.0% 0.9%
[libx264 # 000001e7b4531d40] ref B L1: 97.8% 2.2%
[libx264 # 000001e7b4531d40] kb/s:1483.98
[aac # 000001e7b47fa800] Qavg: 1462.566
There was a bug in the drawbox filter whereby the source alpha pixels would be replaced with the drawbox color's alpha (usually opaque) instead of preserving or blending it. Your command relies on that remaining the case, but I changed that after 3.4 series, so you now have to tell drawbox to replace the alpha for the box pixels.
So,
drawbox=x=200:y=100:w=300:h=150:t=20:c=yellow:replace=1
and
drawbox=x=240:y=140:w=300:h=150:t=20:c=red:replace=1

ffmpeg : Conversion to mkv with compatibility with Samsung BluRay

I have several videos (FullHD resolution) which I want to convert to mkv format and play on my Samsung BluRay Player (model BD-J5900).
Based on User Manual (http://media.datatail.com/docs/manual/252846_en.pdf , page 6) it supports mkv playing if codecs are:
Video : H.264 BP/MP/HP
Audio : MP3
Thus, based on https://ffmpeg.org/ffmpeg.html the command to convert it into proper format is:
ffmpeg -i input.avi -f matroska -vcodec libx264 -acodec mp3 output.mkv
It converts, but file is not playable on player. It say "Video format is not supported".
After checking info here: https://trac.ffmpeg.org/wiki/Encode/H.264 - I thought it may require some compatibility and change the command to :
ffmpeg -i input.avi -f matroska -vcodec libx264 -profile:v baseline -level 3.0 -acodec mp3 output.mkv
But it also didn't help - player demonstrates the same error.
How to fix that?
Thanks!
Updated:
Also tested following options
ffmpeg -i input.file -f matroska -vcodec libx264 -preset veryslow -x264-params bluray_compat=1 -acodec mp3 output.mkv
ffmpeg -i input.file -f matroska -vcodec libx264 -preset veryslow -profile:v high -level 4.2 -x264-params bluray_compat=1 -acodec mp3 output.mkv
ffmpeg -i input.file -f matroska -vcodec libx264 -preset veryslow -profile:v baseline -level 3.0 -x264-params bluray_compat=1 -acodec mp3 output.mkv
ffmpeg -i input.file -vcodec libx264 -vf format=yuv420p -preset veryslow -acodec mp3 output.mkv
Also not supported.
Updated:
Console output for command without profile flag:
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0000019abc2aa4c0] sample aspect ratio already set to 1:1, ignoring 'pasp' atom (65536:65536)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Yehor\Desktop\video_conversion\input\VID_20180620_165336103.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-06-20T22:55:12.000000Z
com.android.version: 7.0
Duration: 00:01:34.19, start: 0.000000, bitrate: 17178 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 17016 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2018-06-20T22:55:12.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2018-06-20T22:55:12.000000Z
handler_name : SoundHandle
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[libx264 # 0000019abc348e00] using SAR=1/1time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A
[libx264 # 0000019abc348e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0000019abc348e00] profile High, level 4.0
[libx264 # 0000019abc348e00] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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
Output #0, matroska, to 'C:\Users\Yehor\Desktop\video_conversion\output\VID_20180620_165336103.mkv':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
com.android.version: 7.0
encoder : Lavf58.12.100
Stream #0:0(eng): Video: h264 (libx264) (H264 / 0x34363248), yuvj420p(pc), 1080x1920 [SAR 1:1 DAR 9:16], q=-1--1, 30 fps, 1k tbn, 30 tbc (default)
Metadata:
encoder : Lavc58.18.100 libx264
creation_time : 2018-06-20T22:55:12.000000Z
handler_name : VideoHandle
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
displaymatrix: rotation of -0.00 degrees
Stream #0:1(eng): Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp (default)
Metadata:
creation_time : 2018-06-20T22:55:12.000000Z
handler_name : SoundHandle
encoder : Lavc58.18.100 libmp3lame
frame= 2823 fps= 15 q=-1.0 Lsize= 80210kB time=00:01:34.10 bitrate=6982.7kbits/s speed=0.492x
video:78692kB audio:1469kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.061441%
[libx264 # 0000019abc348e00] frame I:14 Avg QP:21.43 size:187644
[libx264 # 0000019abc348e00] frame P:728 Avg QP:23.93 size: 68336
[libx264 # 0000019abc348e00] frame B:2081 Avg QP:27.79 size: 13553
[libx264 # 0000019abc348e00] consecutive B-frames: 1.3% 0.6% 2.0% 96.1%
[libx264 # 0000019abc348e00] mb I I16..4: 5.7% 71.5% 22.7%
[libx264 # 0000019abc348e00] mb P I16..4: 2.0% 8.8% 0.9% P16..4: 46.2% 20.0% 12.2% 0.0% 0.0% skip:10.1%
[libx264 # 0000019abc348e00] mb B I16..4: 0.2% 0.9% 0.1% B16..8: 45.3% 4.9% 1.0% direct: 2.8% skip:44.9% L0:45.7% L1:47.3% BI: 7.0%
[libx264 # 0000019abc348e00] 8x8 transform intra:75.1% inter:69.7%
[libx264 # 0000019abc348e00] coded y,uvDC,uvAC intra: 56.8% 70.0% 15.9% inter: 18.3% 19.2% 2.4%
[libx264 # 0000019abc348e00] i16 v,h,dc,p: 18% 33% 15% 34%
[libx264 # 0000019abc348e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 20% 24% 5% 8% 8% 8% 5% 5%
[libx264 # 0000019abc348e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 19% 13% 6% 9% 9% 9% 7% 5%
[libx264 # 0000019abc348e00] i8c dc,h,v,p: 53% 23% 17% 7%
[libx264 # 0000019abc348e00] Weighted P-Frames: Y:15.7% UV:2.6%
[libx264 # 0000019abc348e00] ref P L0: 49.7% 11.2% 25.9% 11.3% 1.9%
[libx264 # 0000019abc348e00] ref B L0: 88.2% 9.2% 2.6%
[libx264 # 0000019abc348e00] ref B L1: 96.2% 3.8%
[libx264 # 0000019abc348e00] kb/s:6843.33
Console output for command with profile flag:
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0000018124b5b080] sample aspect ratio already set to 1:1, ignoring 'pasp' atom (65536:65536)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Yehor\Desktop\video_conversion\input\VID_20180620_165336103.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-06-20T22:55:12.000000Z
com.android.version: 7.0
Duration: 00:01:34.19, start: 0.000000, bitrate: 17178 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 17016 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2018-06-20T22:55:12.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2018-06-20T22:55:12.000000Z
handler_name : SoundHandle
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[libx264 # 0000018124bf9100] using SAR=1/1time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A
[libx264 # 0000018124bf9100] frame MB size (68x120) > level limit (1620)
[libx264 # 0000018124bf9100] DPB size (1 frames, 8160 mbs) > level limit (0 frames, 8100 mbs)
[libx264 # 0000018124bf9100] MB rate (244800) > level limit (40500)
[libx264 # 0000018124bf9100] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0000018124bf9100] profile Constrained Baseline, level 3.0
[libx264 # 0000018124bf9100] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0x131 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=24 chroma_me=1 trellis=2 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 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, matroska, to 'C:\Users\Yehor\Desktop\video_conversion\output\VID_20180620_165336103.mkv':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
com.android.version: 7.0
encoder : Lavf58.12.100
Stream #0:0(eng): Video: h264 (libx264) (H264 / 0x34363248), yuvj420p(pc), 1080x1920 [SAR 1:1 DAR 9:16], q=-1--1, 30 fps, 1k tbn, 30 tbc (default)
Metadata:
encoder : Lavc58.18.100 libx264
creation_time : 2018-06-20T22:55:12.000000Z
handler_name : VideoHandle
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
displaymatrix: rotation of -0.00 degrees
Stream #0:1(eng): Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp (default)
Metadata:
creation_time : 2018-06-20T22:55:12.000000Z
handler_name : SoundHandle
encoder : Lavc58.18.100 libmp3lame
frame= 2823 fps= 11 q=-1.0 Lsize= 106243kB time=00:01:34.16 bitrate=9242.5kbits/s speed=0.358x
video:104723kB audio:1469kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.047877%
[libx264 # 0000018124bf9100] frame I:14 Avg QP:24.31 size:181656
[libx264 # 0000018124bf9100] frame P:2809 Avg QP:27.29 size: 37271
[libx264 # 0000018124bf9100] mb I I16..4: 24.0% 0.0% 76.0%
[libx264 # 0000018124bf9100] mb P I16..4: 2.7% 0.0% 2.0% P16..4: 45.5% 15.6% 4.7% 0.4% 0.1% skip:28.9%
[libx264 # 0000018124bf9100] coded y,uvDC,uvAC intra: 40.3% 61.3% 13.8% inter: 21.0% 20.2% 3.7%
[libx264 # 0000018124bf9100] i16 v,h,dc,p: 22% 30% 23% 26%
[libx264 # 0000018124bf9100] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 15% 12% 9% 12% 12% 12% 9% 7%
[libx264 # 0000018124bf9100] i8c dc,h,v,p: 52% 22% 18% 8%
[libx264 # 0000018124bf9100] kb/s:9107.11
Problem solved with this code:
ffmpeg -f matroska -i input_file.*** -c:v libx264 -preset veryslow -crf 23 -profile:v high -level:v 4.1 -pix_fmt yuv420p -flags global_header -c:a aac output_file.mkv
Tested with ffmpeg 4.0.2 on Windows 10 [x64]
Probably, there is a room to play with CRF to decrease the size of final file.

FFMPEG does not add images to audio

I want to create a slideshow with a background music by ffmpeg, and use the command
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -pix_fmt yuv420p -strict -2 video.mp4
and map.txt is like
file '1.jpg'
duration 15
file '2.jpg'
duration 60
The result is a video with the audio and blank background. If I run the above command without audio as
ffmpeg -f concat -safe 0 -i map.txt -pix_fmt yuv420p -strict -2 video.mp4
a perfect video of the images (the intended slideshow) is generated (but obviously without audio).
I reckon the problem is related to synchronising the audio and images.
This is the terminal output for the first command
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -pix_fmt yuv420p -strict -2 video.mp4
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg # 0x1cc8d40] Changeing bps to 8
Input #0, concat, from 'map.txt':
Duration: 00:05:48.00, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: mjpeg, gray(bt470bg/unknown/unknown), 1920x1080 [SAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, flac, from 'audio.flac':
Metadata:
TITLE : Speak to Me
ARTIST : Creator
ALBUM : Acoustic Hits
track : 14
GENRE : Pop
DATE : 2011
Duration: 00:03:31.02, start: 0.000000, bitrate: 1026 kb/s
Stream #1:0: Audio: flac, 44100 Hz, stereo, s16
[libx264 # 0x1ccdf80] using SAR=1/1
[libx264 # 0x1ccdf80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x1ccdf80] profile High, level 4.0
[libx264 # 0x1ccdf80] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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
Output #0, mp4, to 'video.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp (16 bit), 128 kb/s
Metadata:
encoder : Lavc56.60.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (flac (native) -> aac (native))
Press [q] to stop, [?] for help
[mjpeg # 0x7fe688001ba0] Changeing bps to 8
frame= 2 fps=0.7 q=-1.0 Lsize= 3593kB time=00:03:31.02 bitrate= 139.5kbits/s
video:147kB audio:3410kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.036417%
[libx264 # 0x1ccdf80] frame I:1 Avg QP: 2.55 size: 33683
[libx264 # 0x1ccdf80] frame P:1 Avg QP:19.33 size:116022
[libx264 # 0x1ccdf80] mb I I16..4: 89.7% 1.1% 9.3%
[libx264 # 0x1ccdf80] mb P I16..4: 0.9% 1.8% 30.1% P16..4: 1.4% 1.5% 0.9% 0.0% 0.0% skip:63.4%
[libx264 # 0x1ccdf80] 8x8 transform intra:2.1% inter:15.2%
[libx264 # 0x1ccdf80] coded y,uvDC,uvAC intra: 19.7% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 # 0x1ccdf80] i16 v,h,dc,p: 97% 2% 2% 0%
[libx264 # 0x1ccdf80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 12% 39% 1% 1% 2% 1% 2% 4%
[libx264 # 0x1ccdf80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 16% 16% 3% 4% 6% 5% 5% 4%
[libx264 # 0x1ccdf80] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 # 0x1ccdf80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x1ccdf80] kb/s:20.65
UPDATE (following the comment suggestion)
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -r 5 -pix_fmt yuv420p -strict -2 video.mp4
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg # 0x1fe9d80] Changeing bps to 8
Input #0, concat, from 'map.txt':
Duration: 00:02:28.00, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: mjpeg, gray(bt470bg/unknown/unknown), 1920x1080 [SAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, flac, from 'audio.flac':
Metadata:
TITLE : Speak to Me
ARTIST : Creator
ALBUM : Acoustic Hits
track : 14
GENRE : Pop
DATE : 2011
Duration: 00:03:31.02, start: 0.000000, bitrate: 1026 kb/s
Stream #1:0: Audio: flac, 44100 Hz, stereo, s16
[libx264 # 0x1feefc0] using SAR=1/1
[libx264 # 0x1feefc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x1feefc0] profile High, level 4.0
[libx264 # 0x1feefc0] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=5 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 'video.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 5 fps, 10240 tbn, 5 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp (16 bit), 128 kb/s
Metadata:
encoder : Lavc56.60.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (flac (native) -> aac (native))
Press [q] to stop, [?] for help
[mjpeg # 0x7f74cc001ba0] Changeing bps to 8
frame= 2 fps=0.7 q=-1.0 Lsize= 3593kB time=00:03:31.02 bitrate= 139.5kbits/s
video:147kB audio:3410kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.036417%
[libx264 # 0x1feefc0] frame I:1 Avg QP: 2.55 size: 33683
[libx264 # 0x1feefc0] frame P:1 Avg QP:19.33 size:116022
[libx264 # 0x1feefc0] mb I I16..4: 89.7% 1.1% 9.3%
[libx264 # 0x1feefc0] mb P I16..4: 0.9% 1.8% 30.1% P16..4: 1.4% 1.5% 0.9% 0.0% 0.0% skip:63.4%
[libx264 # 0x1feefc0] 8x8 transform intra:2.1% inter:15.2%
[libx264 # 0x1feefc0] coded y,uvDC,uvAC intra: 19.7% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 # 0x1feefc0] i16 v,h,dc,p: 97% 2% 2% 0%
[libx264 # 0x1feefc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 12% 39% 1% 1% 2% 1% 2% 4%
[libx264 # 0x1feefc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 16% 16% 3% 4% 6% 5% 5% 4%
[libx264 # 0x1feefc0] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 # 0x1feefc0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x1feefc0] kb/s:20.65

ffmpeg get machine readable output

I am trying to find a way to get FFmpeg to return a machine readable output. basically, I just want to know if video conversion was successfull.
I am calling FFmpeg from go code.
output, err := exec.Command("ffmpeg", "-i", source, "-vcodec", "h264", "-acodec", "aac", "-strict", "-2", destination).CombinedOutput()
The above code executes this command :
ffmpeg -i /tmp/pitchVideo-1494844705-102.mp4 -vcodec h264 -acodec aac -strict -2 /tmp/1494844705.mp4
I get the following output:
ffmpeg version 2.4.3-1ubuntu1~trusty6 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 22 2014 17:07:19 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --prefix=/usr --extra-version='1ubuntu1~trusty6' --build-suffix=-ffmpeg --toolchain=hardened --extra-cflags= --extra-cxxflags= --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-fontconfig --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-opengl --enable-x11grab --enable-libxvid --enable-libx265 --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libx264 --enable-libsoxr --enable-openal --enable-libopencv
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/pitchVideo-1494844705-102.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:39.28, start: 0.000000, bitrate: 2300 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x480, 2231 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler
[libx264 # 0x1e12640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX LZCNT
[libx264 # 0x1e12640] profile High, level 3.0
[libx264 # 0x1e12640] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=1 lookahead_threads=1 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
Output #0, mp4, to '/tmp/new.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.4.101
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480, q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc56.1.100 libx264
Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, mono, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc56.1.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 983 fps= 27 q=28.0 Lsize= 4134kB time=00:00:39.24 bitrate= 863.0kbits/s dup=1 drop=0
video:3542kB audio:565kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.646525%
[libx264 # 0x1e12640] frame I:9 Avg QP:19.44 size: 9936
[libx264 # 0x1e12640] frame P:664 Avg QP:23.58 size: 4839
[libx264 # 0x1e12640] frame B:310 Avg QP:25.50 size: 1045
[libx264 # 0x1e12640] consecutive B-frames: 56.0% 4.3% 5.2% 34.6%
[libx264 # 0x1e12640] mb I I16..4: 33.9% 53.6% 12.5%
[libx264 # 0x1e12640] mb P I16..4: 6.7% 10.2% 0.9% P16..4: 50.7% 8.3% 3.0% 0.0% 0.0% skip:20.2%
[libx264 # 0x1e12640] mb B I16..4: 0.4% 0.4% 0.0% B16..8: 41.7% 1.4% 0.1% direct: 1.3% skip:54.7% L0:46.9% L1:50.4% BI: 2.8%
[libx264 # 0x1e12640] 8x8 transform intra:56.8% inter:76.1%
[libx264 # 0x1e12640] coded y,uvDC,uvAC intra: 37.0% 60.5% 13.9% inter: 17.8% 26.0% 0.3%
[libx264 # 0x1e12640] i16 v,h,dc,p: 23% 35% 15% 27%
[libx264 # 0x1e12640] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 27% 21% 4% 4% 4% 4% 5% 5%
[libx264 # 0x1e12640] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 26% 14% 4% 5% 5% 5% 5% 4%
[libx264 # 0x1e12640] i8c dc,h,v,p: 53% 22% 19% 6%
[libx264 # 0x1e12640] Weighted P-Frames: Y:8.7% UV:3.5%
[libx264 # 0x1e12640] ref P L0: 73.8% 15.7% 8.4% 2.0% 0.1%
[libx264 # 0x1e12640] ref B L0: 92.9% 6.2% 0.9%
[libx264 # 0x1e12640] ref B L1: 96.1% 3.9%
[libx264 # 0x1e12640] kb/s:737.84
Edit 1: Maybe I can just check if new video file was generated. But I don't know if that is a dependable way to do it.
Add -progress url to the ffmpeg options, then you will get progress information (machine readable key=value format) every second. You can specify filename, tcp://, http:// etc. as the url. Last key in the progress information is always progress=... The following is an example output (for clarity, blank line is added between progress information).
frame=13164
fps=127.9
stream_0_0_q=29.0
bitrate= 508.9kbits/s
total_size=27962256
out_time_ms=439600181
out_time=00:07:19.600181
dup_frames=0
drop_frames=0
speed=4.27x
progress=continue
frame=13245
fps=128.0
stream_0_0_q=29.0
bitrate= 507.5kbits/s
total_size=28064283
out_time_ms=442386576
out_time=00:07:22.386576
dup_frames=0
drop_frames=0
speed=4.28x
progress=continue
frame=13298
fps=127.6
stream_0_0_q=-1.0
bitrate= 516.9kbits/s
total_size=28675700
out_time_ms=443779773
out_time=00:07:23.779773
dup_frames=0
drop_frames=0
speed=4.26x
progress=end
Example command:
Progress info to file: ffmpeg -progress progressinfo.txt ...
Progress info to local TCP server in port 8910: ffmpeg -progress tcp://127.0.0.1:8910 ...

FFMPEG "buffer queue overflow, dropping" with trim and atrim filters

In FFMPEG I am actually trimming and concating a 24 FPS video. When I apply a complex filter
ffmpeg -i sample.mp4 -filter_complex \
"[0:v]setpts = PTS-STARTPTS[bv];
[bv]split=6[v0][v1][v2][v3][v4][v5];
[v0]trim=start_frame=1:end_frame=142,loop=1:1:1,setpts=N/FRAME_RATE/TB[0v];
[v1]trim=start_frame=846:end_frame=878,loop=1:1:1,setpts=N/FRAME_RATE/TB[1v];
[v2]trim=start_frame=57:end_frame=114,loop=1:1:1,setpts=N/FRAME_RATE/TB[2v];
[v3]trim=start_frame=865:end_frame=885,loop=1:1:1,setpts=N/FRAME_RATE/TB[3v];
[v4]trim=start_frame=70:end_frame=155,loop=1:1:1,setpts=N/FRAME_RATE/TB[4v];
[v5]trim=start_frame=155:end_frame=909,loop=1:1:1,setpts=N/FRAME_RATE/TB[5v];
[0:a]asplit=6[a0][a1][a2][a3][a4][a5];
[a0]atrim=0.041666666666666664:5.917,asetpts=N/SR/TB[0a];
[a1]atrim=35.256:36.603,asetpts=N/SR/TB[1a];
[a2]atrim=2.379:4.767,asetpts=N/SR/TB[2a];
[a3]atrim=36.024:36.859,asetpts=N/SR/TB[3a];
[a4]atrim=2.93:6.438172,asetpts=N/SR/TB[4a];
[a5]atrim=6.438172:37.895,asetpts=N/SR/TB[5a];
[0v][0a][1v][1a][2v][2a][3v][3a][4v][4a][5v][5a]concat=n=6:v=1:a=1[vv][aa]"\
-map "[vv]" -map "[aa]" output.mp4
I am getting "buffer queue overflow, dropping" error. The resultant video and audio is still and not working properly.
ffmpeg version 3.2-1~16.04.york1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.1 (Ubuntu 5.4.1-3ubuntu1~ubuntu16.04.1york0) 20161019
configuration: --prefix=/usr --extra-version='1~16.04.york1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-libtesseract --disable-stripping --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-opengl --enable-sdl2 --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-openal --enable-frei0r --enable-libopencv --enable-libx264 --enable-chromaprint --enable-shared
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.100 / 57. 64.100
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
track : 0
artist :
album :
date : 0
genre :
lyrics :
title :
encoder : Lavf56.36.100
Duration: 00:00:37.90, start: 0.000000, bitrate: 951 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 820 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
Metadata:
handler_name : SoundHandler
File 'output.mp4' already exists. Overwrite ? [y/N] y
[libx264 # 0x55650097a540] using SAR=1/1
[libx264 # 0x55650097a540] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x55650097a540] profile High, level 3.0
[libx264 # 0x55650097a540] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=6 lookahead_threads=1 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=24 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 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
track : 0
artist :
album :
date : 0
genre :
lyrics :
title :
encoder : Lavf57.56.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
Metadata:
encoder : Lavc57.64.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc57.64.100 aac
Stream mapping:
Stream #0:0 (h264) -> setpts
Stream #0:1 (aac) -> asplit
concat:out:v0 -> Stream #0:0 (libx264)
concat:out:a0 -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[Parsed_concat_33 # 0x55650097b420] Buffer queue overflow, dropping. 471.5kbits/s speed=4.94x
Last message repeated 201 times
[Parsed_concat_33 # 0x55650097b420] Buffer queue overflow, dropping. 522.9kbits/s speed=3.89x
Last message repeated 1266 times
[Parsed_concat_33 # 0x55650097b420] Buffer queue overflow, dropping. 557.0kbits/s speed=3.28x
Last message repeated 48 times
[output stream 0:1 # 0x556500947e20] 100 buffers queued in output stream 0:1, something may be wrong.
[Parsed_concat_33 # 0x55650097b420] Buffer queue overflow, dropping. 718.6kbits/s speed=3.46x
Last message repeated 19 times
[output stream 0:0 # 0x5565009785c0] 100 buffers queued in output stream 0:0, something may be wrong.
frame= 1091 fps=117 q=-1.0 Lsize= 2795kB time=00:00:45.51 bitrate= 503.1kbits/s dup=475 drop=0 speed=4.88x
video:2455kB audio:316kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.861779%
[libx264 # 0x55650097a540] frame I:8 Avg QP:19.26 size: 24207
[libx264 # 0x55650097a540] frame P:409 Avg QP:21.33 size: 4108
[libx264 # 0x55650097a540] frame B:674 Avg QP:27.46 size: 949
[libx264 # 0x55650097a540] consecutive B-frames: 10.3% 13.9% 24.5% 51.3%
[libx264 # 0x55650097a540] mb I I16..4: 9.9% 57.0% 33.1%
[libx264 # 0x55650097a540] mb P I16..4: 3.6% 7.6% 2.9% P16..4: 33.0% 10.6% 3.0% 0.0% 0.0% skip:39.2%
[libx264 # 0x55650097a540] mb B I16..4: 0.4% 0.8% 0.4% B16..8: 24.5% 2.6% 0.2% direct: 0.5% skip:70.5% L0:55.5% L1:41.8% BI: 2.7%
[libx264 # 0x55650097a540] 8x8 transform intra:53.8% inter:66.7%
[libx264 # 0x55650097a540] coded y,uvDC,uvAC intra: 44.6% 50.0% 14.8% inter: 6.2% 7.7% 0.2%
[libx264 # 0x55650097a540] i16 v,h,dc,p: 22% 28% 17% 33%
[libx264 # 0x55650097a540] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 23% 28% 3% 4% 3% 11% 3% 5%
[libx264 # 0x55650097a540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 26% 16% 2% 5% 3% 16% 3% 3%
[libx264 # 0x55650097a540] i8c dc,h,v,p: 60% 22% 13% 6%
[libx264 # 0x55650097a540] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x55650097a540] ref P L0: 72.6% 8.4% 15.1% 3.9%
[libx264 # 0x55650097a540] ref B L0: 88.5% 10.7% 0.8%
[libx264 # 0x55650097a540] ref B L1: 93.3% 6.7%
[libx264 # 0x55650097a540] kb/s:442.30
[aac # 0x556500979280] Qavg: 3215.870
I tried with other stackoverflow questions but none of them worked. Also I think it is partially because the trim timings are mixed. That is start time can be anywhere between 0-end. When I make it strictly increasing it is working fine.
Add a fifo filter at the end of each of the video filterchains.
i.e.
[v0]trim=start_frame=1:end_frame=142,loop=1:1:1,setpts=N/FRAME_RATE/TB,fifo[0v];
Although probably not necessary, you can add afifo to the end of audio chains as well.

Resources