1
votes

I'm testing the vda hw accelerated decoder of ffmpeg, but have no luck so far.

the command line I use is this:

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

(the input video can be downloaded here: http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_surround.avi)

but it uses the sw decoder, instead of the requested vda hw decoder.

I debugged ffmpeg.c, and found out that in the function get_format:

if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
    break;

the desc->flag isn't set with AV_PIX_FMT_FLAG_HWACCEL, so it skips the hw acceleration initialization.

the reason is because the pix_fmt is set to AV_PIX_FMT_NONE for some reason, instead of yuv420p as specified by the command.

I then changed the command to this:

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

but what I got was:

Impossible to convert between the formats supported by the filter 'format' and the filter 'auto-inserted scaler 0'


Error opening filters!

Can you please show me an example of using ffmpeg to dump the above video into yuv using the vda hw decoder?

UPDATE from the ffmpeg mailist.

I was told to try the following command instead:

    ./ffmpeg -vcodec h264_vda -i ~/Downloads/big_buck_bunny_720p_surround.avi out.yuv

but this is what I got:

./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

the reason I wanted to try this was because I wanted to use vda with libavcodec in the first place. but the problem I saw was exactly the above. looks like ffmpeg has the same issue.

1

1 Answers

0
votes

I cold emailed the author of libavcodec/vda_h264_dec.c who replied with the following message:

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.


I also remember mp4 has an extradata field, but I don't know what it is.

I quickly tried the following command, it worked:

./ffmpeg -hwaccel vda -i ~/Downloads/big_buck_bunny.mp4 -c:v rawvideo -pix_fmt yuv420p out.yuv​