0

I have 40 .jpg in my dir folder and want to create a video at 20fps from them. I've tried the following command:

find dir/ -iname '*.jpg' | xargs cat | ffmpeg -f image2pipe -framerate 20 -i - -s 1080x720 -pix_fmt yuv420p out.mkv

I expect to obtain a 2 seconds video (40 images / 20 fps) but I get a 6 seconds video. Here is the output of ffmpeg:

[image2pipe @ 0x564d225dd940] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, image2pipe, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 6000x4000, 20 fps, 20 tbr, 20 tbn, 20 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
[swscaler @ 0x564d22b94b00] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x564d225e3180] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x564d225e3180] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x564d225e3180] 264 - core 161 r3039 544c61f - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - 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=20 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 'out.mkv':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p(tv, bt470bg/unknown/unknown, progressive), 1080x720, q=2-31, 20 fps, 1k tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 3 times
frame=    5 fps=0.0 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   11 fps=9.9 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d237e33c0] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 4 times
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
frame=   17 fps= 10 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   23 fps= 10 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 4 times
[swscaler @ 0x564d247610c0] deprecated pixel format used, make sure you did set range correctly
frame=   29 fps= 10 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   35 fps= 10 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 1 times
[swscaler @ 0x564d26bb8f80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 2 times
frame=   41 fps= 10 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   47 fps=9.9 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   53 fps=9.8 q=28.0 size=       1kB time=00:00:00.00 bitrate=5024.0kbits/s speed=0.000184x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   59 fps=9.7 q=28.0 size=       1kB time=00:00:00.30 bitrate=  16.7kbits/s speed=0.0496x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   65 fps=9.7 q=28.0 size=       1kB time=00:00:00.60 bitrate=   8.4kbits/s speed=0.0894x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   71 fps=9.7 q=28.0 size=       1kB time=00:00:00.90 bitrate=   5.6kbits/s speed=0.123x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   77 fps=9.7 q=28.0 size=       1kB time=00:00:01.20 bitrate=   4.2kbits/s speed=0.151x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   83 fps=9.7 q=28.0 size=       1kB time=00:00:01.50 bitrate=   3.3kbits/s speed=0.175x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   89 fps=9.7 q=28.0 size=       1kB time=00:00:01.80 bitrate=   2.8kbits/s speed=0.196x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=   95 fps=9.7 q=28.0 size=       1kB time=00:00:02.10 bitrate=   2.4kbits/s speed=0.213x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=  101 fps=9.7 q=28.0 size=       1kB time=00:00:02.40 bitrate=   2.1kbits/s speed=0.23x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=  107 fps=9.7 q=28.0 size=       1kB time=00:00:02.70 bitrate=   1.9kbits/s speed=0.244x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=  113 fps=9.7 q=28.0 size=       1kB time=00:00:03.00 bitrate=   1.7kbits/s speed=0.258x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 5 times
frame=  119 fps=9.7 q=28.0 size=       1kB time=00:00:03.30 bitrate=   1.5kbits/s speed=0.269x    
[swscaler @ 0x564d22d76680] deprecated pixel format used, make sure you did set range correctly
frame=  120 fps=8.6 q=-1.0 Lsize=    1338kB time=00:00:05.85 bitrate=1873.8kbits/s speed=0.419x    
video:1337kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.115425%
[libx264 @ 0x564d225e3180] frame I:2     Avg QP:22.50  size: 53106
[libx264 @ 0x564d225e3180] frame P:40    Avg QP:23.81  size: 17895
[libx264 @ 0x564d225e3180] frame B:78    Avg QP:26.09  size:  7002
[libx264 @ 0x564d225e3180] consecutive B-frames:  1.7% 16.7% 55.0% 26.7%
[libx264 @ 0x564d225e3180] mb I  I16..4:  7.6% 74.5% 17.9%
[libx264 @ 0x564d225e3180] mb P  I16..4:  2.0% 12.3%  2.5%  P16..4: 43.7% 12.6%  5.6%  0.0%  0.0%    skip:21.3%
[libx264 @ 0x564d225e3180] mb B  I16..4:  0.8%  3.1%  0.4%  B16..8: 35.0%  2.9%  0.5%  direct: 3.7%  skip:53.5%  L0:35.9% L1:61.7% BI: 2.4%
[libx264 @ 0x564d225e3180] 8x8 transform intra:72.9% inter:80.7%
[libx264 @ 0x564d225e3180] coded y,uvDC,uvAC intra: 63.5% 86.3% 57.4% inter: 14.6% 31.4% 3.4%
[libx264 @ 0x564d225e3180] i16 v,h,dc,p: 27% 24% 10% 38%
[libx264 @ 0x564d225e3180] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 16% 16%  7% 10% 10%  9%  8%  8%
[libx264 @ 0x564d225e3180] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 16% 13%  7% 12% 10% 10%  7%  5%
[libx264 @ 0x564d225e3180] i8c dc,h,v,p: 45% 23% 21% 12%
[libx264 @ 0x564d225e3180] Weighted P-Frames: Y:52.5% UV:50.0%
[libx264 @ 0x564d225e3180] ref P L0: 49.9% 20.3% 12.0%  9.1%  8.7%
[libx264 @ 0x564d225e3180] ref B L0: 74.9% 17.1%  8.0%
[libx264 @ 0x564d225e3180] ref B L1: 97.6%  2.4%
[libx264 @ 0x564d225e3180] kb/s:1824.23

Here is some info about the out.mkv file:

Format                                   : Matroska
Format version                           : Version 4
File size                                : 850 KiB
Duration                                 : 6 s 0 ms
Overall bit rate                         : 1 160 kb/s
...
Format settings, Reference frames        : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 6 s 0 ms
Bit rate                                 : 1 137 kb/s
Width                                    : 1 080 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 3:2
Frame rate mode                          : Constant
Frame rate                               : 20.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.073

I've tried different strategies with the -r option, but I cannot get my 2 seconds video at 20 fps. Can you see what going on?

Also I would like to keep a image2pipe solution instead of a image2 solution.

2
  • 1
    Share full log.
    – Gyan
    Sep 19 at 4:07
  • @Gyan I edited the post with the full ffmpeg log Sep 19 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.