[Libav-user] vaapi h.264 decoding with libav

wm4 nfxjfg at googlemail.com
Wed Apr 1 21:00:07 CEST 2015

On Wed, 01 Apr 2015 08:16:51 +0300
Nikita Orlov <nikitos1550 at yandex.ru> wrote:

> Hello!
> Thanks, I will try it.
> But, how to do such thing from c/c++ using libav? 
> I have found some instructions in the internet, but they are not clear.
> One:
> AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt)
> {
>     AVHWAccel *hwaccel=NULL;
>     while((hwaccel= av_hwaccel_next(hwaccel))){
>         if (   hwaccel->id      == codec_id
>             && hwaccel->pix_fmt == pix_fmt)
>             return hwaccel;
>     }
>     return NULL;
> }
> I really don`t understand what to do with AVHWAccel...
> Second 
> find_codec_by_name and set name to h264_vaapi, but people say it doesn`t work.
> P.S. I forgot to say, I use linux OS,

No, h264_vaapi does not exist. Using the hwaccel API is rather
complicated and requires you to set up the decoder yourself etc. I
think the main reason for this is to reduce the amount of vaapi API
code in ffmpeg and to give more control to the application using ffmpeg
or something, but it makes it terrible complicated.

You can look at mpv or vlc code to learn how to use it.

More information about the Libav-user mailing list