[FFmpeg-user] Video Freezing Sometimes, and not other times.
Craig L.
ffmpeg at trafficality.com
Wed May 12 03:05:02 EEST 2021
I am running into an issue where I will encode a video and the primary
video (in the command below it is the one called test-video.mp4) will at
some point freeze frame while the other streams continue to encode and
then play back correctly.
The problem is that I haven't been able to recreate the issue yet
because the people that experience it, re-convert the video and on the
second try it pretty much always comes out correctly and at this point,
I don't want to wait until I see it again to see if someone might have a
clue of what to look for.
Here is a glossary of what the inputs are:
testcanvas.txt is a background image looped with the duration of 137.550
test-textfile.txt is a concat of images that are overlayed.
test-video-two.mov is an overlaid video that does not freeze and goes
all the way to the end.
test-video.mp4 is the primary video, the one that is freezing.
I have an auto-delete script running and I thought that /maybe/ in the
middle of the encode, the video in question was accidentally being
deleted causing the freeze frame, but I have tested this and it doesn't
seem to be the case, but I haven't fully ruled it out.
*COMMAND*
/usr/local/bin/ffmpeg -safe 0 -f concat -i testcanvas.txt -safe 0 -f
concat -i test-textfile.txt -i test-video.mp4 -i
test-video-two.mov -filter_complex_script test-complex-filter.txt
-aspect 1:1 -c:v libx264 -profile:v high -pix_fmt yuv420p -level
5.1 -vsync 1 -async 1 -c:a aac -b:a 128k -map 2:a -r 30 -t
137.550 -y test-output7.mp4
Here is the filter used from the complex_filter_script:
[2:v]trim=start=0:end=137.550,setpts=PTS-STARTPTS,format=yuv420p[101v];[2:a]atrim=start=0:end=137.550,asetpts=PTS-STARTPTS[101a];[101v][101a]concat=n=1:v=1:a=1[2];[2]scale=1280:-2[2v];[0][2v]overlay=0:280[2v];[2v][1]overlay=0:0[v];[0:v]scale=1280:-2[f];[f][v]overlay=0:0[b];[3]scale=1280:-2[3v];[b][3v]overlay=0:280.00002
So, since I unfortunately don't have an actual example where this
happened, is there anything in my command that might cause this
intermittent behavior?
Here is the output, but again, this time it turned out fine without the
test-video.mp4 freeze-framing about 6 seconds before the end of the
total video, but maybe this will help?
/usr/local/bin/ffmpeg -safe 0 -f concat -i testcanvas.txt -safe 0 -f
concat -i test-textfile.txt -i test-video.mp4 -i
test-video-two.mov -filter_complex_script test-complex-filter.txt
-aspect 1:1 -c:v libx264 -profile:v high -pix_fmt yuv420p -level
5.1 -vsync 1 -async 1 -c:a aac -b:a 128k -map 2:a -t 137.550
-r 30 -t 137.550 -y test-output7.mp4
ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ Copyright
(c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gmp --enable-libgme --enable-gray
--enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf
--enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis
--enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d
--enable-libxvid --enable-libzvbi --enable-libzimg
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, concat, from 'testcanvas.txt':
Duration: 00:02:17.55, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: targa, gray, 1280x1280, 25 tbr, 25 tbn, 25 tbc
Input #1, concat, from 'test-textfile.txt':
Duration: 00:02:17.45, start: 0.000000, bitrate: 0 kb/s
Stream #1:0: Video: targa, bgra, 1280x1280, 25 tbr, 25 tbn, 25 tbc
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'test-video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2021-05-05T19:42:20.000000Z
Duration: 00:02:17.55, start: 0.000000, bitrate: 836 kb/s
Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 704 kb/s, 30 fps, 30
tbr, 15360 tbn, 60 tbc (default)
Metadata:
creation_time : 2021-05-05T19:42:20.000000Z
handler_name : ISO Media file produced by Google Inc. Created
on: 05/05/2021.
Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 127 kb/s (default)
Metadata:
creation_time : 2021-05-05T19:42:20.000000Z
handler_name : ISO Media file produced by Google Inc. Created
on: 05/05/2021.
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'test-video-two.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf58.45.100
Duration: 00:02:17.56, start: 0.000000, bitrate: 53 kb/s
Stream #3:0: Video: png (png / 0x20676E70), rgba(pc, progressive),
1280x14, 52 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.91.100 png
Stream mapping:
Stream #0:0 (targa) -> overlay:main
Stream #0:0 (targa) -> scale
Stream #1:0 (targa) -> overlay:overlay
Stream #2:0 (h264) -> trim
Stream #2:1 (aac) -> atrim
Stream #3:0 (png) -> scale
concat:out:a0 -> Stream #0:0 (aac)
overlay -> Stream #0:1 (libx264)
Press [q] to stop, [?] for help
-async is forwarded to lavfi similarly to -af
aresample=async=1:min_hard_comp=0.100000:first_pts=0.
[libx264 @ 0x7352900] using SAR=1/1
[libx264 @ 0x7352900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0x7352900] profile High, level 5.1, 4:2:0, 8-bit
[libx264 @ 0x7352900] 264 - core 161 r3018 db0d417 - 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=40 lookahead_threads=6 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 'test-output7.mp4':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.91.100 aac
Stream #0:1: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
1280x1280 [SAR 1:1 DAR 1:1], q=-1--1, 30 fps, 15360 tbn, 30 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
frame= 4127 fps= 89 q=-1.0 Lsize= 15749kB time=00:02:17.55 bitrate=
937.9kbits/s dup=1 drop=0 speed=2.97x
video:13439kB audio:2163kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.942718%
[aac @ 0x7496900] Qavg: 445.198
[libx264 @ 0x7352900] frame I:17 Avg QP:16.54 size: 64367
[libx264 @ 0x7352900] frame P:1108 Avg QP:19.51 size: 7111
[libx264 @ 0x7352900] frame B:3002 Avg QP:20.76 size: 1595
[libx264 @ 0x7352900] consecutive B-frames: 0.4% 7.2% 1.9% 90.5%
[libx264 @ 0x7352900] mb I I16..4: 33.2% 48.3% 18.5%
[libx264 @ 0x7352900] mb P I16..4: 2.1% 2.8% 0.1% P16..4: 16.2%
5.9% 2.5% 0.0% 0.0% skip:70.4%
[libx264 @ 0x7352900] mb B I16..4: 0.1% 0.1% 0.0% B16..8: 13.9%
1.0% 0.0% direct: 0.3% skip:84.6% L0:45.2% L1:53.7% BI: 1.0%
[libx264 @ 0x7352900] 8x8 transform intra:53.7% inter:91.8%
[libx264 @ 0x7352900] coded y,uvDC,uvAC intra: 23.2% 55.9% 9.6% inter:
2.0% 4.0% 0.0%
[libx264 @ 0x7352900] i16 v,h,dc,p: 47% 22% 8% 24%
[libx264 @ 0x7352900] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 23% 34% 2% 3%
2% 3% 2% 2%
[libx264 @ 0x7352900] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 29% 12% 2% 4%
4% 3% 3% 2%
[libx264 @ 0x7352900] i8c dc,h,v,p: 55% 15% 26% 4%
[libx264 @ 0x7352900] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7352900] ref P L0: 63.7% 6.0% 21.7% 8.6%
[libx264 @ 0x7352900] ref B L0: 79.6% 15.7% 4.7%
[libx264 @ 0x7352900] ref B L1: 94.2% 5.8%
[libx264 @ 0x7352900] kb/s:800.25
More information about the ffmpeg-user
mailing list