在 Linux 上,我尝试使用硬件加速将文件编码为 H\xe2\x82\xacVC。成功的尝试是:
\nffmpeg -v verbose -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i \'/path/file.mkv\' -vcodec libx265 -crf 28 \'/path/file.mp4\'\nRun Code Online (Sandbox Code Playgroud)\n但速度很慢,如 30fps,“ ffmpeg -codecs|grep 265”显示:\n(编码器: libx265 nvenc_hevc hevc_amf hevc_nvenc hevc_qsv hevc_v4l2m2m hevc_vaapi )
所以我尝试了hevc_vaapi:
\nffmpeg -v verbose -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i \'/path/file.mkv\' -vcodec hevc_vaapi -crf 28 \'/path/file.mp4\'\nRun Code Online (Sandbox Code Playgroud)\n但它失败了:
\nImpossible to convert between the formats supported by the filter \'Parsed_null_0\' and the filter \'auto_scaler_0\'\nError reinitializing filters!\nFailed to inject frame into filter network: Function not implemented\nError while processing the decoded data for stream #0:0\n[AVIOContext @ 0x55d831121340] Statistics: 0 seeks, 0 writeouts\n[aac @ 0x55d831142a00] Qavg: 30414.529\n[aac @ 0x55d831142a00] 2 frames left in the queue on closing\n[AVIOContext @ 0x55d831109ec0] Statistics: 65536 bytes read, 0 seeks\nConversion failed!\nRun Code Online (Sandbox Code Playgroud)\n$ ffmpeg -hwaccels 显示“
\nHardware acceleration methods:\nvdpau\ncuda\nvaapi\nqsv\ndrm\nRun Code Online (Sandbox Code Playgroud)\n”
\n$ vaapi显示此\n(似乎 va-api 在那里,mesa 驱动程序)
\n$ ls /dev/dri/*
\n\n\n/dev/dri/card0 /dev/dri/renderD128
\n/dev/dri/by-path:
\npci-0000:0a:00.0-卡 pci-0000:0a:00.0-渲染
\n
您对此错误有何看法,或者您将如何继续发现哪些 ffmpeg 参数用于 HW H\xe2\x82\xacVC 加速?
\n更新:我认为“-hwaccel vaapi”可能是多余的参数
\n我认为它需要正确的编码参数,例如如果您有VAAPI 驱动程序,-vf 'format=nv12,hwupload'则以下一行可能会起作用:
echo "Input file:" && read -r i && echo "Quality: 25=identic, 30=a bit worse but small file size, or other numbers:" && read -r q && ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -vf 'format=nv12,hwupload' -c:v hevc_vaapi -f mp4 -rc_mode 1 -qp "$q" "$i.hevc.mp4"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19435 次 |
| 最近记录: |