嘗試使用英特爾 QuickSync 進行 ffmpeg,「初始化編碼器時發生錯誤:視訊參數無效(-15)

嘗試使用英特爾 QuickSync 進行 ffmpeg,「初始化編碼器時發生錯誤:視訊參數無效(-15)

我經常在沒有英特爾快速同步的情況下執行 ffmpeg,例如建立一個名為「a」的子目錄,ffmpeg -i IMG_0001.MOV -c:a libmp3lame -c:v libx264 -preset ultrafast ffff.mp4

(我知道 mp4 容器中的 mp3 有點過時,aac 是當前的約定/標準,但我的舊視頻編輯器不喜歡其中的 aac。而且我知道現在 libx264 的質量有點低,但它對我來說沒問題,我不認為這是問題的根源)

我想嘗試使用英特爾快速同步進行編碼,據我所知它更快。

我使用的筆記型電腦的處理器是i5 3230m,支援quicksynchttps://ark.intel.com/content/www/us/en/ark/products/72056/intel-core-i53230m-processor-3m-cache-up-to-3-20-ghz-bga.html

我執行命令ffmpeg -i IMG_0030.MOV -acodec copy -vcodec h264_qsv blah.mp4

但我得到了錯誤

[h264_qsv @ 00000000004ddd40] Error initializing the encoder: invalid video parameters (-15)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width
or height
Conversion failed!

--

G:\vids\apple> ffmpeg -i IMG_0030.MOV -acodec copy -vcodec h264_qsv blah.mp4
ffmpeg version N-94664-g0821bc4eee Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --e
nable-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 --ena
ble-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enabl
e-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 --enable-libopenmpt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.101 / 58. 55.101
  libavformat    58. 31.104 / 58. 31.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.101 /  7. 58.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0030.MOV':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2022-06-01T13:55:35.000000Z
    com.apple.quicktime.location.accuracy.horizontal: 4.782269
    com.apple.quicktime.location.ISO6709: +51.9016-000.2051+094.310/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 11 Pro
    com.apple.quicktime.software: 15.3.1
    com.apple.quicktime.creationdate: 2022-06-01T14:55:34+0100
  Duration: 00:00:11.78, start: 0.000000, bitrate: 22869 kb/s
    Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1920x1080, 22685 kb/s, 119.99 fps, 120 tbr, 2400 tbn, 2400 tbc (defa
ult)
    Metadata:
      rotate          : 90
      creation_time   : 2022-06-01T13:55:35.000000Z
      handler_name    : Core Media Video
      encoder         : HEVC
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 162 kb/s (default)
    Metadata:
      creation_time   : 2022-06-01T13:55:35.000000Z
      handler_name    : Core Media Audio
File 'blah.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_qsv))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264_qsv @ 00000000004ddd40] Error initializing the encoder: invalid video parameters (-15)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width
or height
Conversion failed!

我注意到 h264_qsv 被列出,ffmpeg -encoders我想這可能意味著 ffmpeg 版本支援它

C:\Users\User>ffmpeg -encoders | grep 264
ffmpeg version N-94664-g0821bc4eee Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --e
nable-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 --ena
ble-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enabl
e-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 --enable-libopenmpt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.101 / 58. 55.101
  libavformat    58. 31.104 / 58. 31.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.101 /  7. 58.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
 V..... libx264              libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
 V..... libx264rgb           libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)
 V..... h264_amf             AMD AMF H.264 Encoder (codec h264)
 V..... h264_nvenc           NVIDIA NVENC H.264 encoder (codec h264)
 V..... h264_qsv             H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264)
 V..... nvenc                NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc_h264           NVIDIA NVENC H.264 encoder (codec h264)

添加

這是使用此命令的嘗試所以,指定 crf,作為建議的註釋ffmpeg -i IMG_0001.MOV -c:a copy -c:v h264_qsv -crf 23 aaa.mp4

它以青色顯示“[h264_qsv @ 00000000003804c0]”,然後以紅色顯示“[h264_qsv @ 00000000003804c0] 初始化編碼器時出錯:視頻流參數無效 (-15) 初始化輸出流時出錯編碼器#0:0 - 參數可能不正確,例如位元率、速率、寬度或高度”

然後顯示灰色,“轉換失敗!”正如你在下面看到的

G:\vids\apple>ffmpeg -i IMG_0001.MOV -c:a copy -c:v h264_qsv -crf 23 aaa.mp4

ffmpeg version N-94664-g0821bc4eee Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --e
nable-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 --ena
ble-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enabl
e-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 --enable-libopenmpt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.101 / 58. 55.101
  libavformat    58. 31.104 / 58. 31.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.101 /  7. 58.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0001.MOV':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2022-02-26T21:21:16.000000Z
    com.apple.quicktime.location.accuracy.horizontal: 20.738540
    com.apple.quicktime.location.ISO6709: +51.6208-000.2740+066.132/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 11 Pro
    com.apple.quicktime.software: 14.8
    com.apple.quicktime.creationdate: 2022-02-26T21:21:16+0000
  Duration: 00:00:01.10, start: 0.000000, bitrate: 12855 kb/s
    Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1920x1080, 12623 kb/s, 29.95 fps, 29.97 tbr, 600 tbn, 600 tbc (defau
lt)
    Metadata:
      rotate          : 90
      creation_time   : 2022-02-26T21:21:16.000000Z
      handler_name    : Core Media Video
      encoder         : HEVC
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
    Metadata:
      creation_time   : 2022-02-26T21:21:16.000000Z
      handler_name    : Core Media Audio
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2022-02-26T21:21:16.000000Z
      handler_name    : Core Media Metadata
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2022-02-26T21:21:16.000000Z
      handler_name    : Core Media Metadata
    Stream #0:4(und): Data: none (mebx / 0x7862656D), 34 kb/s (default)
    Metadata:
      creation_time   : 2022-02-26T21:21:16.000000Z
      handler_name    : Core Media Metadata
File 'aaa.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_qsv))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264_qsv @ 00000000001504c0] Error initializing the encoder: invalid video parameters (-15)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width
or height
Conversion failed!

G:\vids\apple>

如果我將-c:a copy 更改為-c:a libmp3lame,那麼我也會在yelloe 中收到此訊息「為輸出檔案#0 (aaa.mp4) 指定的Codec AVOption crf(選擇恆定質量模式的質量)尚未被用於任何串流。當我不指定 -crf 時,我不會收到該訊息。

相關內容