0

I am trying to create videos from images. Although I have done this many times, I see now that a certain video stops before the last frame, encoding only ~50% of it.

The way I call ffmpeg is

ffmpeg -y -threads 16 -r 30 -i /tmp/teaser/SINGLE/%*_2_.png -vcodec h264  -vf scale=2000:-2 -an -b:v 5000k /tmp/teaser_SINGLE_2_.mp4

The output is:

Output #0, mp4, to     '/tmp/teaser_SINGLE_2_.mp4':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 2000x1316, q=-1--1, 5000 kb/s, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.48.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=6 speed=0.0278x    x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=16 speed=0.0237x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=23 speed=0.022x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba drop=30 speed=0.0206x
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba drop=47 speed=0.0172x
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba drop=54 speed=0.0163x
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=59 speed=0.0155x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba drop=65 speed=0.0148x
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=71 speed=0.0141x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=77 speed=0.0135x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=90 speed=0.0124x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=148 speed=0.00909x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=179 speed=0.00786x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
Input stream #0:0 frame changed from size:2000x1315 fmt:rgba to size:2000x1315 fmt:pal8 drop=184 speed=0.00765x
Input stream #0:0 frame changed from size:2000x1315 fmt:pal8 to size:2000x1315 fmt:rgba
frame=   64 fps=2.6 q=-1.0 Lsize=     822kB time=00:00:02.03 bitrate=3310.7kbits/s dup=0 drop=209 speed=0.0822x
video:820kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.190141%
[libx264 @ 0x7feb45023a00] frame I:1     Avg QP:13.80  size:  6902
[libx264 @ 0x7feb45023a00] frame P:16    Avg QP: 4.91  size: 20914
[libx264 @ 0x7feb45023a00] frame B:47    Avg QP: 9.96  size: 10589
[libx264 @ 0x7feb45023a00] consecutive B-frames:  1.6%  0.0%  4.7% 93.8%
[libx264 @ 0x7feb45023a00] mb I  I16..4:  0.2% 98.3%  1.6%
[libx264 @ 0x7feb45023a00] mb P  I16..4:  0.1%  0.1%  0.5%  P16..4:  0.3%  0.6%  0.6%  0.0%  0.0%    skip:97.8%
[libx264 @ 0x7feb45023a00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.6%  0.6%  0.6%  direct: 0.2%  skip:98.0%  L0:35.6% L1:34.8% BI:29.7%
[libx264 @ 0x7feb45023a00] final ratefactor: 0.46
[libx264 @ 0x7feb45023a00] 8x8 transform intra:87.7% inter:9.6%
[libx264 @ 0x7feb45023a00] coded y,u,v intra: 9.6% 6.6% 8.9% inter: 1.2% 0.4% 0.8%
[libx264 @ 0x7feb45023a00] i16 v,h,dc,p: 83% 10%  6%  1%
[libx264 @ 0x7feb45023a00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29%  1% 70%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x7feb45023a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 11% 14%  5%  5%  8%  5% 10%  5%
[libx264 @ 0x7feb45023a00] Weighted P-Frames: Y:6.2% UV:6.2%
[libx264 @ 0x7feb45023a00] ref P L0: 53.5% 16.5% 18.2% 11.2%  0.6%
[libx264 @ 0x7feb45023a00] ref B L0: 86.6% 10.8%  2.7%
[libx264 @ 0x7feb45023a00] ref B L1: 93.8%  6.2%
[libx264 @ 0x7feb45023a00] kb/s:3147.04

There doesn't seem to be any destroyed frame. Any idea?

I use ffmpeg version 3.1.4

2
  • 1
    Has to do something with naming. Try renaming it a numeric sequence. Also, use -framerate 30 instead of -r 30.
    – Gyan
    Nov 8, 2016 at 15:49
  • Just the -framerate 30 did the job!!!!! But I don't understand why. If you want please post this as an answer so that I can mark this as accepted.
    – dim_tz
    Nov 8, 2016 at 15:53

1 Answer 1

1

With image sequences, you have to use the framerate option. With -r specified before the sequence name, FFmpeg assumes 25 fps and duplicates/drop frames to meet the set rate. I'm guessing you had a very short sequence, so it wasn't readily apparent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.