Hello, I'm trying to create a video from a series of PNG frames and then loop specific frames using the loop filter. It is giving me a bit of trouble. Ffmpeg is dropping a single frame somewhere and I'm not sure why that is. Would appreciate it if someone could take a look.
Essentially I have a concat demuxer input with 32 frames. I would like to repeat frame #16 104 times. And repeat frame #34 14 times. 32 input frames + 104 + 14 = 150 frames. At 30fps, my intention is to produce a 5 second video with exactly 150 frames. But I can only manage to produce 149 frames. Here is my filtergraph. I would like to repeat frames 16 and 32 (looping from back to front to ensure the loops dont interfere with frame indexes of subsequent loop filters) $ cat 054d50ac-fb18-46af-bb35-53dbebcd8b99.filtergraph [0]null[layer_0]; [1]null[layer_1]; [layer_1]loop=loop=14:start=32:size=1,loop=loop=104:start=16:size=1,setpts=expr=N/(30.000000*TB)[layer_1_loopedFrames]; [layer_0]fps=fps=30.000000[layer_0_fps]; [layer_1_loopedFrames]fps=fps=30.000000[layer_1_loopedFrames_fps]; [layer_0_fps][layer_1_loopedFrames_fps]overlay=x=0.0:y=0.0:format=auto[overlay_all] (firstly, I would like to mention that the documentation says that the loop filter uses 0-based indexing, but from my testing, both 0-based and 1-based indexing produce the same output, that is, both indexing methods drop a single frame and result in 149 frames. Both methods also produce identical binary files) Here is the contents of my concat demuxer input (line numbers added for clarity) $ cat dcdbbcd7-f1b1-4ed4-8647-741e33b619a1.txt | nl 1 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0000_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 2 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0001_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 3 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0002_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 4 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0003_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 5 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0004_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 6 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0005_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 7 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0006_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 8 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0007_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 9 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0008_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 10 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0009_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 11 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0010_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 12 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0011_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 13 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0012_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 14 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0013_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 15 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0014_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 16 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0015_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 17 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0016_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 18 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0017_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 19 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0018_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 20 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0019_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 21 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0020_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 22 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0021_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 23 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0022_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 24 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0023_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 25 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0024_63f44d9f-1853-4888-907c-d38c2a8fe8ad.png' 26 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0000_ce71dcbc-1ac7-4e69-8b72-37c7f7c40aed.png' 27 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0001_ce71dcbc-1ac7-4e69-8b72-37c7f7c40aed.png' 28 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0002_ce71dcbc-1ac7-4e69-8b72-37c7f7c40aed.png' 29 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0003_ce71dcbc-1ac7-4e69-8b72-37c7f7c40aed.png' 30 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0004_ce71dcbc-1ac7-4e69-8b72-37c7f7c40aed.png' 31 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0005_ce71dcbc-1ac7-4e69-8b72-37c7f7c40aed.png' 32 file '/var/canva/export/video/tmp/19bea535-d9bf-40f3-aa25-eb15f22bd604/0006_ce71dcbc-1ac7-4e69-8b72-37c7f7c40aed.png' $ sudo ffmpeg -y -r 30 -i background.jpeg -f concat -r 30.0 -safe 0 -i dcdbbcd7-f1b1-4ed4-8647-741e33b619a1.txt -filter_complex_script 054d50ac-fb18-46af-bb35-53dbebcd8b99.filtergraph -map [overlay_all] -c:v libx264 -pix_fmt yuv420p -colorspace bt709 -color_trc bt709 -color_primaries bt709 -color_range tv out.mp4 ffmpeg version 4.2.2-1build1~18.04.sav0 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1) configuration: --prefix=/usr --extra-version='1build1~18.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared 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 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 [mjpeg @ 0x55e6b9c4d0c0] EOI missing, emulating Input #0, jpeg_pipe, from 'background.jpeg': Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 400x400 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc Input #1, concat, from 'dcdbbcd7-f1b1-4ed4-8647-741e33b619a1.txt': Duration: N/A, start: 0.000000, bitrate: N/A Stream #1:0: Video: png, rgba(pc), 400x400, 25 tbr, 25 tbn, 25 tbc Stream mapping: Stream #0:0 (mjpeg) -> null Stream #1:0 (png) -> null overlay -> Stream #0:0 (libx264) Press [q] to stop, [?] for help [concat @ 0x55e6b9c50740] DTS -230584300921369 < 0 out of order DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 [swscaler @ 0x55e6b9d1e900] deprecated pixel format used, make sure you did set range correctly [libx264 @ 0x55e6b9c6eb80] using SAR=1/1 [libx264 @ 0x55e6b9c6eb80] using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX [libx264 @ 0x55e6b9c6eb80] profile High, level 2.1 [libx264 @ 0x55e6b9c6eb80] 264 - core 155 r2917 0a84d98 - 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=3 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 'out.mp4': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(tv, bt709), 400x400 [SAR 1:1 DAR 1:1], 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 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 DTS -230584300921369, next:40000 st:0 invalid dropping PTS -230584300921369, next:40000 invalid dropping st:0 frame= 149 fps=0.0 q=-1.0 Lsize= 24kB time=00:00:04.86 bitrate= 39.8kbits/s speed=14.5x video:21kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 12.099166% [libx264 @ 0x55e6b9c6eb80] frame I:1 Avg QP:10.12 size: 85 [libx264 @ 0x55e6b9c6eb80] frame P:38 Avg QP:14.50 size: 145 [libx264 @ 0x55e6b9c6eb80] frame B:110 Avg QP:17.37 size: 139 [libx264 @ 0x55e6b9c6eb80] consecutive B-frames: 0.7% 0.0% 8.1% 91.3% [libx264 @ 0x55e6b9c6eb80] mb I I16..4: 100.0% 0.0% 0.0% [libx264 @ 0x55e6b9c6eb80] mb P I16..4: 1.4% 4.4% 0.0% P16..4: 1.4% 0.6% 0.1% 0.0% 0.0% skip:92.1% [libx264 @ 0x55e6b9c6eb80] mb B I16..4: 0.2% 0.0% 0.0% B16..8: 1.3% 0.0% 0.0% direct: 4.6% skip:93.8% L0:42.8% L1:54.0% BI: 3.2% [libx264 @ 0x55e6b9c6eb80] 8x8 transform intra:50.3% inter:100.0% [libx264 @ 0x55e6b9c6eb80] coded y,uvDC,uvAC intra: 0.2% 7.1% 5.8% inter: 0.0% 4.4% 1.1% [libx264 @ 0x55e6b9c6eb80] i16 v,h,dc,p: 91% 5% 3% 0% [libx264 @ 0x55e6b9c6eb80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 1% 8% 90% 0% 0% 0% 0% 0% 0% [libx264 @ 0x55e6b9c6eb80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 0% 50% 47% 0% 0% 0% 0% 0% 3% [libx264 @ 0x55e6b9c6eb80] i8c dc,h,v,p: 90% 5% 5% 0% [libx264 @ 0x55e6b9c6eb80] Weighted P-Frames: Y:18.4% UV:18.4% [libx264 @ 0x55e6b9c6eb80] ref P L0: 88.0% 4.1% 5.4% 1.1% 1.4% [libx264 @ 0x55e6b9c6eb80] ref B L0: 94.7% 3.9% 1.4% [libx264 @ 0x55e6b9c6eb80] ref B L1: 97.7% 2.3% [libx264 @ 0x55e6b9c6eb80] kb/s:33.65 Things I've tried: - using 0-based indexing - using 1-based indexing - adding 'duration 0.0333' after each line in the concat demuxer input (this removes the DTS/PTS warnings, but doesn't change the output) My suspicion is that there is some extra bit of ffmpeg knowledge that is needed to get this to work correctly that I am missing. Would appreciate any help. Thanks! _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".