gpt4 book ai didi

video - 使用 vda 加速的 ffmpeg 解码示例?

转载 作者:行者123 更新时间:2023-12-04 23:03:53 25 4
gpt4 key购买 nike

我正在测试ffmpeg的vda hw加速解码器,但到目前为止还没有运气。

我使用的命令行是这样的:

./ffmpeg -hwaccel vda -i ~/Downloads/big_buck_bunny_720p_surround.avi -c:v rawvideo -pix_fmt yuv420p out.yuv

(输入视频可以在这里下载: http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_surround.avi)

但它使用 sw 解码器,而不是请求的 vda hw 解码器。

我调试了ffmpeg.c,发现在get_format函数中:
if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
break;

desc->flag 未使用 AV_PIX_FMT_FLAG_HWACCEL 设置,因此它跳过硬件加速初始化。

原因是 pix_fmt 出于某种原因设置为 AV_PIX_FMT_NONE,而不是命令指定的 yuv420p。

然后我将命令更改为:
./ffmpeg -hwaccel vda -i ~/Downloads/big_buck_bunny_720p_surround.avi -c:v rawvideo -pix_fmt vda_vld out.yuv

但我得到的是:
Impossible to convert between the formats supported by the filter 'format' and the filter 'auto-inserted scaler 0'


Error opening filters!

您能否给我看一个使用 ffmpeg 使用 vda hw 解码器将上述视频转储到 yuv 的示例?

来自 ffmpeg postman 的更新。

我被告知尝试以下命令:
    ./ffmpeg -vcodec h264_vda -i ~/Downloads/big_buck_bunny_720p_surround.avi out.yuv

但这就是我得到的:
./ffmpeg -vcodec h264_vda -i ~/Downloads/big_buck_bunny_720p_surround.avi out.yuv

ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration:
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
[10:20:50.169] vtDecompressionDuctCreate signalled err=-8973 (err) (Could not select and open decoder instance) at /SourceCache/CoreMedia_frameworks/CoreMedia-1562.107/Sources/VideoToolbox/VTDecompressionSession.c line 1181
[h264_vda @ 0x7f9feb034600] Failed to init VDA decoder: -12473.
[avi @ 0x7f9feb00da00] Failed to open codec in av_find_stream_info
[NULL @ 0x7f9feb034600] missing picture in access unit with size 9960
[10:20:50.252] vtDecompressionDuctCreate signalled err=-8973 (err) (Could not select and open decoder instance) at /SourceCache/CoreMedia_frameworks/CoreMedia-1562.107/Sources/VideoToolbox/VTDecompressionSession.c line 1181
[h264_vda @ 0x7f9feb034600] Failed to init VDA decoder: -12473.
[NULL @ 0x7f9feb034600] missing picture in access unit with size 457

我想尝试这个的原因是因为我想首先将 vda 与 libavcodec 一起使用。但我看到的问题正是上述。看起来ffmpeg也有同样的问题。

最佳答案

我冷冷地给 libavcodec/vda_h264_dec.c 的作者发了电子邮件谁回复了以下消息:

I'm not very surprised that the VDA decoder cannot be properly inited here. I guess you probably eventually have to remux your video to use MP4 or MKV container.

I don't know exactly what happens there, but according to my experience playing with VDA framework before, that framework had quite a few limitations. I guess the limitation you met might be that, it required some extra data of the video to init the decoder, which made it support only some of the containers. I forget what the exact name of that extra data, but AFAIK, only MP4-compatible container could provide that.



我还记得 mp4 有一个 extradata 字段,但我不知道它是什么。

我很快尝试了以下命令,它起作用了:
./ffmpeg -hwaccel vda -i ~/Downloads/big_buck_bunny.mp4 -c:v rawvideo -pix_fmt yuv420p out.yuv​

关于video - 使用 vda 加速的 ffmpeg 解码示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29089892/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com