3

I'm trying to do a simple task with ffmpeg. I've pre-generated about 100 png images (all same resolution) and separetely generated a list of them to be used by ffmpeg to concat them into a video. Each frame is likely to be used more than once. The output video is to be about 10,000 frames.

The problem is that ffmpeg stops at about frame 4000 with no error. The final video works with no error.

ffmpeg command:

ffmpeg -f concat -i frame_list.txt -vf fps=10 output.mov 

frame_list.txt sample:

 file 'frame_0045.png' file 'frame_0046.png' file 'frame_0047.png' file 'frame_0046.png' file 'frame_0047.png' 

ffmpeg output:

ffmpeg version 2.3.3- http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2014 the FFmpeg developers built on Sep 2 2014 16:32:53 with gcc 4.8 (Debian 4.8.3-9) configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --disable-ffserver --enable-libass --enable-gnutls --cc=gcc-4.8 libavutil 52. 92.100 / 52. 92.100 libavcodec 55. 69.100 / 55. 69.100 libavformat 55. 48.100 / 55. 48.100 libavdevice 55. 13.102 / 55. 13.102 libavfilter 4. 11.100 / 4. 11.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100 Input #0, concat, from 'frame_list.txt': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: png, rgba64be, 1920x400 [SAR 72:72 DAR 24:5], 25 tbr, 25 tbn, 25 tbc File 'output.mov' already exists. Overwrite ? [y/N] No pixel format specified, yuv444p for H.264 encoding chosen. Use -pix_fmt yuv420p for compatibility with outdated media players. [libx264 @ 0x38a6e20] using SAR=1/1 [libx264 @ 0x38a6e20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0x38a6e20] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit [libx264 @ 0x38a6e20] 264 - core 142 r50 dd79a61 - 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=4 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=10 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, mov, to 'output.mov': Metadata: encoder : Lavf55.48.100 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1920x400 [SAR 1:1 DAR 24:5], q=-1--1, 10 fps, 10240 tbn, 10 tbc Metadata: encoder : Lavc55.69.100 libx264 Stream mapping: Stream #0:0 -> #0:0 (png (native) -> h264 (libx264)) Press [q] to stop, [?] for help 

Blah blah does all concat-ing and then stops at frame 4040 for unknown reason

frame= 4040 fps= 13 q=-1.0 Lsize= 2301kB time=00:06:43.80 bitrate= 46.7kbits/s video:2254kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.067943% [libx264 @ 0x38a6e20] frame I:17 Avg QP:13.43 size: 22332 [libx264 @ 0x38a6e20] frame P:1297 Avg QP:12.44 size: 1003 [libx264 @ 0x38a6e20] frame B:2726 Avg QP:13.00 size: 230 [libx264 @ 0x38a6e20] consecutive B-frames: 9.9% 0.4% 0.2% 89.5% [libx264 @ 0x38a6e20] mb I I16..4: 15.8% 68.5% 15.7% [libx264 @ 0x38a6e20] mb P I16..4: 0.1% 0.5% 0.3% P16..4: 0.8% 0.2% 0.2% 0.0% 0.0% skip:98.0% [libx264 @ 0x38a6e20] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 1.6% 0.1% 0.0% direct: 0.0% skip:98.2% L0:51.6% L1:45.9% BI: 2.6% [libx264 @ 0x38a6e20] 8x8 transform intra:62.7% inter:16.1% [libx264 @ 0x38a6e20] coded y,u,v intra: 14.7% 8.5% 9.2% inter: 0.1% 0.0% 0.0% [libx264 @ 0x38a6e20] i16 v,h,dc,p: 60% 35% 4% 0% [libx264 @ 0x38a6e20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 2% 56% 0% 0% 0% 0% 0% 0% [libx264 @ 0x38a6e20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 14% 21% 6% 4% 5% 5% 6% 4% [libx264 @ 0x38a6e20] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x38a6e20] ref P L0: 59.3% 5.1% 20.4% 15.2% [libx264 @ 0x38a6e20] ref B L0: 72.2% 22.5% 5.3% [libx264 @ 0x38a6e20] ref B L1: 97.2% 2.8% [libx264 @ 0x38a6e20] kb/s:45.70 
4
  • Why are you using the concat demuxer instead of normal usage of the image file demuxer? ffmpeg -start_number 45 -framerate 10 -i frame_%04d.png output or ffmpeg -framerate 10 -pattern_type glob -i "*.png" output Commented Sep 11, 2015 at 14:40
  • The answer to that question is that I don't know. I can't see how I can give the sequence of frames by using the commands you suggest. I've got 100 frames that are my source frames and the final video uses them as required . It's basically pictures of a speedometer at each speed concatenated in the right order to build a data overlay for helmet cam footage. Commented Sep 11, 2015 at 23:05
  • Ah, I didn't notice the repeated frames. I guess the lame method to use the image file demuxer would be to reorder and rename the files in the proper sequence. Commented Sep 11, 2015 at 23:45
  • no chance I will do that, lol Commented Sep 12, 2015 at 6:19

1 Answer 1

3

I did see this in the output:

frame= 4040 fps= 13 

Look at this closer too:

Input #0, concat, from 'frame_list.txt': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: png, rgba64be, 1920x400 [SAR 72:72 DAR 24:5], 25 tbr, 25 tbn, 25 tbc 

It is saying 25 Frame rate instead of 10 for the input. So FFMPEG thinks it has input of 25FPS and that is more than double 10 which is why you stopped at 4040 and not all PNG being used. 10,000 Frames divided by 25FPS input equals 400 times 10FPS output equals 4000 and it then stops.

Try these arguments:

ffmpeg -r 1/5 -f concat -i frame_list.txt -vf fps=10 output.mov 

You can see that your logging the default framerate for the Input File as I mentioned above, and that is the 25 FPS with no specified duration or bitrate for Input.

-r 1/5 means each image will have a duration of 5 seconds (the inverse of 1/5 frames per second) or you can change this around but I don't think it will use each PNG twice as you are stating. But you can play around with that setting 1/10 to get the 10,000 frame output or combine multiple output video files together after you get the desired display time for each PNG. Just be sure to change the Output name each time for each new MOV as you export.

Sign up to request clarification or add additional context in comments.

5 Comments

well it's not much help to try different frame rates, the video I'm generating is for a data overlay so it needs to be fps=10, which I set. I had assumed what ffmpeg is reporting in the line that says fps=13 is that it is concatenating 13 frames to the video every second.
Yes I only stated this as a test to find out why all the PNG's were not being used. By trying different frame rates you may find it uses all of the PNG's then you would know your culprit. Also at that point you could then recode the MOV output to 10 FPS from the MOV not the PNG. Worth a try but yeah I am not sure why it says 13 FPS as it should be able to encode 1 Frame at 10 FPS in no time at all since it is the same frame. Hope this helps since FFMPEG is hit or miss sometimes in these areas.
I updated my ANSWER and it should be solved or give you the right direction to go in.
thanks for your help, your suggested arguments worked except that I had to use -r instead of -framerate
Excellent! I updated my answer with -r... glad to help!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.