我经常不使用英特尔 quicksync 来执行 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 时出错 -- 打开输出流 #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 时,我不会收到该消息。