FFmpeg 语法将 PNG 连接到 H.265 MKV

FFmpeg 语法将 PNG 连接到 H.265 MKV

我已经检查了 FFmpeg 文档级联H.264, 和H.265按照指示,我整理了 pnglist.txt,其中包含如下行:

file 'D:\Folder\Screenshots\scr2020-01-01-14_10_31.png'
file 'D:\Folder\Screenshots\scr2020-01-01-14_10_33.png'
file 'D:\Folder\Screenshots\scr2020-01-01-14_10_36.png'

我把看似必需的元素组合起来,形成一个命令,将这些 1920x1080 的 PNG 串成一个视频:

ffmpeg -f concat -safe 0 -i pnglist.txt -c:v libx265 -preset slow -crf 22 -c:a aac -b:a 128k -c:a copy output.mkv

我还没有音频。我想我可以先制作视频,然后重新运行命令,等我弄清楚要添加什么音频后再进行修改。

此命令以及我尝试过的变体(例如,删除音频部分)会产生各种错误。我似乎误解了 FFmpeg 中关于连接的一些基本知识。我该如何修改此命令以将这些 PNG 连接成 MKV?

为了回答问题,我记录了这个修改后的命令的结果:

ffmpeg -f concat -safe 0 -i pnglist.txt -c:v libx265 -preset slow -crf 22 -c:a copy -report output.mkv

pnglist.txt 中有 15 张 PNG,生成的日志文件的内容如下:

ffmpeg started on 2020-01-03 at 12:49:46
Report written to "ffmpeg-20200103-124946.log"
Log level: 48
Command line:
ffmpeg -f concat -safe 0 -i pnglist.txt -c:v libx265 -preset slow -crf 22 -c:a copy -report output.mkv
ffmpeg version git-2020-01-01-7b58702 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20191125
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 38.100 / 56. 38.100
  libavcodec     58. 65.100 / 58. 65.100
  libavformat    58. 35.101 / 58. 35.101
  libavdevice    58.  9.102 / 58.  9.102
  libavfilter     7. 70.101 /  7. 70.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument 'concat'.
Reading option '-safe' ... matched as AVOption 'safe' with argument '0'.
Reading option '-i' ... matched as input url with argument 'pnglist.txt'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx265'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'slow'.
Reading option '-crf' ... matched as AVOption 'crf' with argument '22'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option 'output.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url pnglist.txt.
Applying option f (force format) with argument concat.
Successfully parsed a group of options.
Opening an input file: pnglist.txt.
[concat @ 0000015de368aa40] Opening 'pnglist.txt' for reading
[file @ 0000015de368b2c0] Setting default whitelist 'file,crypto'
[NULL @ 0000015de3694c80] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_03.png' for reading
[png_pipe @ 0000015de3694c80] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3694c80] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3694c80] After avformat_find_stream_info() pos: 346288 bytes read:346288 seeks:0 frames:1
[concat @ 0000015de368aa40] Before avformat_find_stream_info() pos: 870 bytes read:870 seeks:0 nb_streams:1
[concat @ 0000015de368aa40] file:0 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
[concat @ 0000015de368aa40] All info found
[concat @ 0000015de368aa40] After avformat_find_stream_info() pos: 870 bytes read:870 seeks:0 frames:1
Input #0, concat, from 'pnglist.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: png, rgba(pc), 1920x1080 [SAR 3779:3779 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output url output.mkv.
Applying option c:v (codec name) with argument libx265.
Applying option c:a (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: output.mkv.
[file @ 0000015de3699940] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 8 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> hevc (libx265))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de369d540] Statistics: 346288 bytes read, 0 seeks
[NULL @ 0000015de3694c80] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_05.png' for reading
[png_pipe @ 0000015de3694c80] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3694c80] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3694c80] After avformat_find_stream_info() pos: 349039 bytes read:349039 seeks:0 frames:1
[concat @ 0000015de368aa40] file:1 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:-230584300921369 pts_time:-9.22337e+12 dts:-230584300921369 dts_time:-9.22337e+12
[concat @ 0000015de368aa40] DTS -230584300921369 < 0 out of order
DTS -230584300921369, next:40000 st:0 invalid dropping
PTS -230584300921369, next:40000 invalid dropping st:0
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de3695380] Statistics: 349039 bytes read, 0 seeks
[NULL @ 0000015de3c32900] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_08.png' for reading
[png_pipe @ 0000015de3c32900] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32900] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32900] After avformat_find_stream_info() pos: 383959 bytes read:383959 seeks:0 frames:1
[concat @ 0000015de368aa40] file:2 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de3c32480] Statistics: 383959 bytes read, 0 seeks
[NULL @ 0000015de3c32900] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_09.png' for reading
[png_pipe @ 0000015de3c32900] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32900] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32900] After avformat_find_stream_info() pos: 388406 bytes read:388406 seeks:0 frames:1
[concat @ 0000015de368aa40] file:3 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:-230584300921369 pts_time:-9.22337e+12 dts:-230584300921369 dts_time:-9.22337e+12
[concat @ 0000015de368aa40] DTS -230584300921369 < 0 out of order
DTS -230584300921369, next:40000 st:0 invalid dropping
PTS -230584300921369, next:40000 invalid dropping st:0
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de36a6840] Statistics: 388406 bytes read, 0 seeks
[NULL @ 0000015de3c32900] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_13.png' for reading
[png_pipe @ 0000015de3c32900] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32900] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32900] After avformat_find_stream_info() pos: 396257 bytes read:396257 seeks:0 frames:1
[concat @ 0000015de368aa40] file:4 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de36a6840] Statistics: 396257 bytes read, 0 seeks
[NULL @ 0000015de3c32900] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_14.png' for reading
[png_pipe @ 0000015de3c32900] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32900] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32900] After avformat_find_stream_info() pos: 431820 bytes read:431820 seeks:0 frames:1
[concat @ 0000015de368aa40] file:5 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:-230584300921369 pts_time:-9.22337e+12 dts:-230584300921369 dts_time:-9.22337e+12
[concat @ 0000015de368aa40] DTS -230584300921369 < 0 out of order
DTS -230584300921369, next:40000 st:0 invalid dropping
PTS -230584300921369, next:40000 invalid dropping st:0
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de36a6840] Statistics: 431820 bytes read, 0 seeks
[NULL @ 0000015de3c32900] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_16.png' for reading
[png_pipe @ 0000015de3c32900] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32900] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32900] After avformat_find_stream_info() pos: 379185 bytes read:379185 seeks:0 frames:1
[concat @ 0000015de368aa40] file:6 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de36a6840] Statistics: 379185 bytes read, 0 seeks
[NULL @ 0000015de3c32900] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_17.png' for reading
[png_pipe @ 0000015de3c32900] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32900] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32900] After avformat_find_stream_info() pos: 364810 bytes read:364810 seeks:0 frames:1
[concat @ 0000015de368aa40] file:7 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:-230584300921369 pts_time:-9.22337e+12 dts:-230584300921369 dts_time:-9.22337e+12
[concat @ 0000015de368aa40] DTS -230584300921369 < 0 out of order
DTS -230584300921369, next:40000 st:0 invalid dropping
PTS -230584300921369, next:40000 invalid dropping st:0
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de36a6840] Statistics: 364810 bytes read, 0 seeks
[NULL @ 0000015de3c32900] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_19.png' for reading
[png_pipe @ 0000015de3c32900] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32900] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32900] After avformat_find_stream_info() pos: 320629 bytes read:320629 seeks:0 frames:1
[concat @ 0000015de368aa40] file:8 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
[graph 0 input from stream 0:0 @ 0000015de3c32540] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0000015de3c32540] Setting 'pix_fmt' to value '26'
[graph 0 input from stream 0:0 @ 0000015de3c32540] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 0000015de3c32540] Setting 'pixel_aspect' to value '3779/3779'
[graph 0 input from stream 0:0 @ 0000015de3c32540] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0000015de3c32540] w:1920 h:1080 pixfmt:rgba tb:1/25 fr:25/1 sar:3779/3779
[format @ 0000015de3bdccc0] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|gbrp|yuv420p10le|yuv422p10le|yuv444p10le|gbrp10le|gray|gray10le'
[auto_scaler_0 @ 0000015de3724a80] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0000015de3724a80] w:iw h:ih flags:'bicubic' interl:0
[format @ 0000015de3bdccc0] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0000015de3bd9880] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed
[auto_scaler_0 @ 0000015de3724a80] picking gbrp out of 13 ref:rgba alpha:1
[swscaler @ 0000015de5ee8400] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_0 @ 0000015de3724a80] w:1920 h:1080 fmt:rgba sar:3779/3779 -> w:1920 h:1080 fmt:gbrp sar:1/1 flags:0x4
[matroska @ 0000015de3697540] get_metadata_duration returned: 0
Output #0, matroska, to 'output.mkv':
  Metadata:
    encoder         : Lavf58.35.101
    Stream #0:0, 0, 1/1000: Video: hevc (libx265), gbrp, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.65.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Clipping frame in rate conversion by 0.000008
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de36a6840] Statistics: 320629 bytes read, 0 seeks
[NULL @ 0000015de3c32900] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_22.png' for reading
[png_pipe @ 0000015de3c32900] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32900] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32900] After avformat_find_stream_info() pos: 319894 bytes read:319894 seeks:0 frames:1
[concat @ 0000015de368aa40] file:9 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:-230584300921369 pts_time:-9.22337e+12 dts:-230584300921369 dts_time:-9.22337e+12
[concat @ 0000015de368aa40] DTS -230584300921369 < 0 out of order
DTS -230584300921369, next:40000 st:0 invalid dropping
PTS -230584300921369, next:40000 invalid dropping st:0
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de5dc43c0] Statistics: 319894 bytes read, 0 seeks
[NULL @ 0000015de3c32880] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_23.png' for reading
[png_pipe @ 0000015de3c32880] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32880] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32880] After avformat_find_stream_info() pos: 331360 bytes read:331360 seeks:0 frames:1
[concat @ 0000015de368aa40] file:10 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de5dc43c0] Statistics: 331360 bytes read, 0 seeks
[NULL @ 0000015de3c32780] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_25.png' for reading
[png_pipe @ 0000015de3c32780] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32780] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32780] After avformat_find_stream_info() pos: 362743 bytes read:362743 seeks:0 frames:1
[concat @ 0000015de368aa40] file:11 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:-230584300921369 pts_time:-9.22337e+12 dts:-230584300921369 dts_time:-9.22337e+12
[concat @ 0000015de368aa40] DTS -230584300921369 < 0 out of order
DTS -230584300921369, next:40000 st:0 invalid dropping
PTS -230584300921369, next:40000 invalid dropping st:0
Past duration 0.999992 too large
*** dropping frame 2 from stream 0 at ts 0
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de5dc4500] Statistics: 362743 bytes read, 0 seeks
[NULL @ 0000015de3c32780] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_30.png' for reading
[png_pipe @ 0000015de3c32780] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32780] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32780] After avformat_find_stream_info() pos: 428035 bytes read:428035 seeks:0 frames:1
[concat @ 0000015de368aa40] file:12 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
frame=    3 fps=0.0 q=0.0 size=       3kB time=00:00:00.00 bitrate=N/A dup=0 drop=1 speed=   0x    
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de5dc43c0] Statistics: 428035 bytes read, 0 seeks
[NULL @ 0000015de3c32780] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_38.png' for reading
[png_pipe @ 0000015de3c32780] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32780] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32780] After avformat_find_stream_info() pos: 544176 bytes read:544176 seeks:0 frames:1
[concat @ 0000015de368aa40] file:13 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:-230584300921369 pts_time:-9.22337e+12 dts:-230584300921369 dts_time:-9.22337e+12
[concat @ 0000015de368aa40] DTS -230584300921369 < 0 out of order
DTS -230584300921369, next:40000 st:0 invalid dropping
PTS -230584300921369, next:40000 invalid dropping st:0
*** dropping frame 3 from stream 0 at ts 0
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[AVIOContext @ 0000015de5dc43c0] Statistics: 544176 bytes read, 0 seeks
[NULL @ 0000015de3c32780] Opening 'D:\Current\Screenshots\scr2020-01-01-08_21_39.png' for reading
[png_pipe @ 0000015de3c32780] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000015de3c32780] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[png_pipe @ 0000015de3c32780] After avformat_find_stream_info() pos: 618939 bytes read:618939 seeks:0 frames:1
[concat @ 0000015de368aa40] file:14 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
*** dropping frame 3 from stream 0 at ts 1
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
*** dropping frame 3 from stream 0 at ts 0
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
*** dropping frame 3 from stream 0 at ts 1
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
*** dropping frame 3 from stream 0 at ts 0
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
*** dropping frame 3 from stream 0 at ts 1
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
*** dropping frame 3 from stream 0 at ts 0
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
*** dropping frame 3 from stream 0 at ts 1
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
*** dropping frame 3 from stream 0 at ts 0
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
*** dropping frame 3 from stream 0 at ts 1
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[out_0_0 @ 0000015de369bf80] EOF on sink link out_0_0:default.
*** dropping frame 3 from stream 0 at ts 0
No more output streams to write to, finishing.
[matroska @ 0000015de3697540] Starting new cluster with timestamp 0 at offset 2900 bytes
[matroska @ 0000015de3697540] Writing block of size 267213 with pts 0, dts -80, duration 40 at relative offset 9 in cluster at offset 2900. TrackNumber 1, keyframe 1
[matroska @ 0000015de3697540] Writing block of size 95914 with pts 80, dts -40, duration 40 at relative offset 267230 in cluster at offset 2900. TrackNumber 1, keyframe 0
[matroska @ 0000015de3697540] Writing block of size 1281 with pts 40, dts 0, duration 40 at relative offset 363152 in cluster at offset 2900. TrackNumber 1, keyframe 0
[matroska @ 0000015de3697540] end duration = 120
[matroska @ 0000015de3697540] stream 0 end duration = 120
frame=    3 fps=1.6 q=-0.0 Lsize=     359kB time=00:00:00.00 bitrate=2939000.0kbits/s dup=0 drop=12 speed=0.000532x    
video:356kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.814197%
Input file #0 (pnglist.txt):
  Input stream #0:0 (video): 15 packets read (5965540 bytes); 15 frames decoded; 
  Total: 15 packets (5965540 bytes) demuxed
Output file #0 (output.mkv):
  Output stream #0:0 (video): 3 frames encoded; 3 packets muxed (364408 bytes); 
  Total: 3 packets (364408 bytes) muxed
15 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000015de3699a80] Statistics: 8 seeks, 8 writeouts
[AVIOContext @ 0000015de5dc43c0] Statistics: 618939 bytes read, 0 seeks
[AVIOContext @ 0000015de36944c0] Statistics: 870 bytes read, 0 seeks

最终结果是一段由两帧组成的可播放视频。在屏幕上,当此命令运行时,似乎大多数(如果不是全部)输入 PNG 都会产生“无效删除”的警告。

答案1

我必须在图像之间添加持续时间才能最终制作视频。之前的运行产生了与您的类似的“无效删除”错误。我像这样添加了持续时间:

file '/path/to/dog.png'
duration 5
file '/pathto/cat.png'
duration 1
file '/path/to/rat.png'
duration 3
file '/path/to/tapeworm.png'
duration 2

我的命令和你的不同

ffmpeg -f concat -safe 0 -i ./mylist.txt -vsync vfr -pix_fmt yuv420p output.mp4

但目的类似。

我在ffmpeg wiki 幻灯片。我最初在该页面上列出了两次最后一张图片,但删除它并重新运行命令后发现没有必要。

相关内容