如何在 ffmpeg 中使用 zscale 过滤器?

如何在 ffmpeg 中使用 zscale 过滤器?

我正在使用 ffmpeg v3.3.2 Win64 Static,在使用 zscale 过滤器时遇到了麻烦。这是我尝试从命令行执行的命令:

ffmpeg -i input.mkv -vf bwdif=1:0:0,zscale=w=-1:h=720:f=spline36:r=full -c:v libx264 -preset slow -crf 23 -tune animation -movflags +faststart -c:a copy output.m4v

我得到的输出与执行以下命令相同:

ffmpeg -i input.mkv

在我得到这个之前什么也没发生:

ffmpeg.exe 已停止工作

当我执行:

ffmpeg -filters

我看到 zscale 过滤器的以下条目:

..C zscale            V->V       Apply resizing, colorspace and bit depth conversion.

C 代表“命令支持”,但我不明白这是什么意思。

如果我仅执行“ffmpeg -i”,我会得到:

ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid
                 --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc
                 --enable-avisynth --enable-bzlib --enable-fontconfig
                 --enable-frei0r --enable-gnutls --enable-iconv --enable-libass
                 --enable-libbluray --enable-libbs2b --enable-libcaca
                 --enable-libfreetype --enable-libgme --enable-libgsm
                 --enable-libilbc --enable-libmodplug --enable-libmp3lame
                 --enable-libopencore-amrnb --enable-libopencore-amrwb
                 --enable-libopenh264 --enable-libopenjpeg --enable-libopus
                 --enable-librtmp --enable-libsnappy --enable-libsoxr
                 --enable-libspeex --enable-libtheora --enable-libtwolame
                 --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
                 --enable-libvpx --enable-libwavpack --enable-libwebp
                 --enable-libx264 --enable-libx265 --enable-libxavs
                 --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100

--enable-libzimg选项位于配置中,是 zscale 过滤器所需的。

我不确定我在这里遗漏了什么,因此如果能提供任何帮助我将不胜感激。

更新日志:

ffmpeg started on 2017-07-30 at 12:16:22
Report written to "ffmpeg-20170730-121622.log"
Command line:
ffmpeg -report -i "Episode 01-1.mkv" -vf "bwdif=1:0:0,zscale=w=-1:h=720:f=spline36:r=full" -c:v libx264 -preset slow -crf 23 -tune animation -movflags +faststart -c:a copy "Episode 01-1.m4v"
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input url with argument 'Episode 01-1.mkv'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'bwdif=1:0:0,zscale=w=-1:h=720:f=spline36:r=full'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'slow'.
Reading option '-crf' ... matched as AVOption 'crf' with argument '23'.
Reading option '-tune' ... matched as AVOption 'tune' with argument 'animation'.
Reading option '-movflags' ... matched as AVOption 'movflags' with argument '+faststart'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'Episode 01-1.m4v' ... 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 Episode 01-1.mkv.
Successfully parsed a group of options.
Opening an input file: Episode 01-1.mkv.
[NULL @ 0000000000d371c0] Opening 'Episode 01-1.mkv' for reading
[file @ 0000000002513e80] Setting default whitelist 'file,crypto'
[matroska,webm @ 0000000000d371c0] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 0000000000d371c0] Before avformat_find_stream_info() pos: 1291 bytes read:32768 seeks:0 nb_streams:2
[matroska,webm @ 0000000000d371c0] All info found
[matroska,webm @ 0000000000d371c0] After avformat_find_stream_info() pos: 8083 bytes read:32768 seeks:0 frames:5
Input #0, matroska,webm, from 'Episode 01-1.mkv':
  Metadata:
    title           : SOUTH PARK SEASON 1
    ENCODER         : Lavf57.71.100
  Duration: 00:24:11.01, start: 0.000000, bitrate: 5655 kb/s
    Stream #0:0(eng), 2, 1/1000: Video: mpeg2video (Main), yuv420p(tv, top first), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
    Metadata:
      BPS-eng         : 5497718
      DURATION-eng    : 00:24:10.949500000
      NUMBER_OF_FRAMES-eng: 43485
      NUMBER_OF_BYTES-eng: 997113640
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.10.6 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-07-23 18:20:55
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      DURATION        : 00:24:10.993000000
    Stream #0:1(eng), 3, 1/1000: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:24:11.008000000
Successfully opened the file.
Parsing a group of options: output url Episode 01-1.m4v.
Applying option vf (set video filters) with argument bwdif=1:0:0,zscale=w=-1:h=720:f=spline36:r=full.
Applying option c:v (codec name) with argument libx264.
Applying option c:a (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: Episode 01-1.m4v.
[file @ 0000000002518640] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 8 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[mpeg2video @ 00000000025d3720] allocating dummy last picture for B frame
[Parsed_bwdif_0 @ 0000000000d3ea20] Setting 'mode' to value '1'
[Parsed_bwdif_0 @ 0000000000d3ea20] Setting 'parity' to value '0'
[Parsed_bwdif_0 @ 0000000000d3ea20] Setting 'deint' to value '0'
[Parsed_zscale_1 @ 0000000000d36c80] Setting 'w' to value '-1'
[Parsed_zscale_1 @ 0000000000d36c80] Setting 'h' to value '720'
[Parsed_zscale_1 @ 0000000000d36c80] Setting 'f' to value 'spline36'
[Parsed_zscale_1 @ 0000000000d36c80] Setting 'r' to value 'full'
[graph 0 input from stream 0:0 @ 00000000025b35e0] Setting 'video_size' to value '720x480'
[graph 0 input from stream 0:0 @ 00000000025b35e0] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 00000000025b35e0] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 0:0 @ 00000000025b35e0] Setting 'pixel_aspect' to value '8/9'
[graph 0 input from stream 0:0 @ 00000000025b35e0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 00000000025b35e0] Setting 'frame_rate' to value '30000/1001'
[graph 0 input from stream 0:0 @ 00000000025b35e0] w:720 h:480 pixfmt:yuv420p tb:1/1000 fr:30000/1001 sar:8/9 sws_param:flags=2
[format @ 0000000003ad4c60] compat: called with args=[yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21]
[format @ 0000000003ad4c60] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21'
[AVFilterGraph @ 00000000025d1f60] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
[Parsed_zscale_1 @ 0000000000d36c80] w:720 h:480 fmt:yuv420p sar:8/9 -> w:1080 h:720 fmt:yuv420p sar:8/9
[libx264 @ 00000000025bbba0] using mv_range_thread = 24
[libx264 @ 00000000025bbba0] using SAR=8/9
[libx264 @ 00000000025bbba0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 00000000025bbba0] profile High, level 4.0
[libx264 @ 00000000025bbba0] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=10 deblock=1:1:1 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=0.40:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=5 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:0.60
Output #0, ipod, to 'Episode 01-1.m4v':
  Metadata:
    title           : SOUTH PARK SEASON 1
    encoder         : Lavf57.71.100
    Stream #0:0(eng), 0, 1/60000: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1080x720 [SAR 8:9 DAR 4:3], q=-1--1, 59.94 fps, 60k tbn, 59.94 tbc
    Metadata:
      BPS-eng         : 5497718
      DURATION-eng    : 00:24:10.949500000
      NUMBER_OF_FRAMES-eng: 43485
      NUMBER_OF_BYTES-eng: 997113640
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.10.6 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-07-23 18:20:55
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      DURATION        : 00:24:10.993000000
      encoder         : Lavc57.89.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng), 0, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:24:11.008000000
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[Parsed_zscale_1 @ 0000000000d36c80] w:720 h:480 fmt:yuv420p sar:8/9 -> w:1080 h:720 fmt:yuv420p sar:8/9

日志文件中有多个实例cur_dts is invalid,但我不知道这是否会给 zscale 造成问题。

相关内容