ffmpeg 将视频转换为图像序列范围

ffmpeg 将视频转换为图像序列范围

我正在尝试将 1425 秒到 1430 秒的视频转换为一系列图像。以下是我的代码,但不起作用。我该怎么做?

ffmpeg -i video.MP4 -vf select='between(t,1425,1430)' -vsync 0 out%d.png

ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers   built with gcc 7.3.1 (GCC) 20180722   configuration: --enable-gpl
--enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth   libavutil      56. 14.100 / 56. 14.100   libavcodec     58. 18.100 / 58. 18.100   libavformat    58. 12.100 / 58. 12.100   libavdevice    58.  3.100 /
58.  3.100   libavfilter     7. 16.100 /  7. 16.100   libswscale      5.  1.100 /  5.  1.100   libswresample   3.  1.100 /  3.  1.100   libpostproc    55.  1.100 / 55.  1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Ouchy-2-Left-cropped-pred.MP4':   Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf56.36.100   Duration: 00:39:24.97, start: 0.000000, bitrate: 1582 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 650x300 [SAR 1:1 DAR 13:6], 1581 kb/s, 30 fps, 30 tbr, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler Stream mapping:   Stream #0:0 -> #0:0 (mpeg4 (native) -> png (native)) Press [q] to stop, [?] for help [Parsed_select_0 @ 000001b56bd6eb80] [Eval @ 000000a2fd7fe1a0] Missing ')' or too many args in 'between(t' [Parsed_select_0 @ 000001b56bd6eb80] Error while parsing expression 'between(t' [AVFilterGraph @ 000001b56b67edc0] Error initializing filter 'select' with args 'between(t' Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #0:0 Conversion failed!

答案1

您需要转义逗号,因为 ffmpeg 过滤器是使用逗号来划定的。

所以,

ffmpeg -i video.MP4 -vf select='between(t\,1425\,1430)' -vsync 0 out%d.png

相关内容