当我尝试从一组帧创建视频时,ffmpeg输出单帧视频

时间:2019-01-24 19:46:01

标签: ffmpeg

我有几组框架,想从中创建视频。

我使用以下命令:

/usr/local/bin/ffmpeg -i /tmp/frames/0.png -i /tmp/frames/1.png -i /tmp/frames/2.png -i /tmp/frames/3.png -i /tmp/frames/4.png -i /tmp/frames/5.png -i /tmp/frames/6.png -i /tmp/frames/7.png -i /tmp/frames/8.png -i /tmp/frames/9.png -i /tmp/frames/10.png -i /tmp/frames/11.png -i /tmp/frames/12.png -i /tmp/frames/13.png -i /tmp/frames/14.png -i /tmp/frames/15.png -i /tmp/frames/16.png -i /tmp/frames/17.png -i /tmp/frames/18.png -i /tmp/frames/19.png -i /tmp/frames/20.png -i /tmp/frames/21.png -i /tmp/frames/22.png -i /tmp/frames/23.png -i /tmp/frames/24.png -i /tmp/frames/25.png -i /tmp/frames/26.png -i /tmp/frames/27.png -i /tmp/frames/28.png -i /tmp/frames/29.png -i /tmp/frames/30.png -i /tmp/frames/31.png -i /tmp/frames/32.png -i /tmp/frames/33.png -i /tmp/frames/34.png -i /tmp/frames/35.png -i /tmp/frames/36.png -i /tmp/frames/37.png -i /tmp/frames/38.png -i /tmp/frames/39.png -i /tmp/frames/40.png -i /tmp/frames/41.png -i /tmp/frames/42.png -i /tmp/frames/43.png -i /tmp/frames/44.png -i /tmp/frames/45.png -i /tmp/frames/46.png -i /tmp/frames/47.png -i /tmp/frames/48.png -i /tmp/frames/49.png -i /tmp/frames/50.png -i /tmp/frames/51.png -i /tmp/frames/52.png -i /tmp/frames/53.png -i /tmp/frames/54.png -i /tmp/frames/55.png -i /tmp/frames/56.png -i /tmp/frames/57.png -i /tmp/frames/58.png -i /tmp/frames/59.png -i /tmp/frames/60.png -i /tmp/frames/61.png -i /tmp/frames/62.png -i /tmp/frames/63.png -i /tmp/frames/64.png -i /tmp/frames/65.png -i /tmp/frames/66.png -i /tmp/frames/67.png -i /tmp/frames/68.png -i /tmp/frames/69.png -i /tmp/frames/70.png -i /tmp/frames/71.png -i /tmp/frames/72.png -i /tmp/frames/73.png -i /tmp/frames/74.png -i /tmp/frames/75.png -i /tmp/frames/76.png -i /tmp/frames/77.png -i /tmp/frames/78.png -i /tmp/frames/79.png -i /tmp/frames/80.png -i /tmp/frames/81.png -i /tmp/frames/82.png -i /tmp/frames/83.png -i /tmp/frames/84.png -i /tmp/frames/85.png -i /tmp/frames/86.png -i /tmp/frames/87.png -i /tmp/frames/88.png -i /tmp/frames/89.png -i /tmp/frames/90.png -i /tmp/frames/91.png -i /tmp/frames/92.png -i /tmp/frames/93.png -i /tmp/frames/94.png -i /tmp/frames/95.png -i /tmp/frames/96.png -i /tmp/frames/97.png -i /tmp/frames/98.png -i /tmp/frames/99.png -vcodec libx264 -pix_fmt yuv420p -r 25 -t 4 -y /tmp/0.mp4

但是最终的视频只是一帧:

ffmpeg -i /tmp/0.mp4 
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.10.44.4)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-chromaprint --enable-frei0r --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libgme --enable-libgsm --enable-libmodplug --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-librsvg --enable-librtmp --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtesseract --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libwavpack --enable-libwebp --enable-libzimg --enable-libzmq --enable-opencl --enable-openssl --enable-videotoolbox --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.3.0/include/openjpeg-2.3 --enable-nonfree
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/0.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:00.04, start: 0.000000, bitrate: 684 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x800, 524 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler

怎么了?

1 个答案:

答案 0 :(得分:0)

使用image demuxer序列模式:

ffmpeg -framerate 25 -i %d.png -c:v libx264 -vf format=yuv420p -movflags +faststart output.mp4