[Libav-user] VA-API decoding on Android [ffmpeg-2.1]

Michael Goffioul michael.goffioul at gmail.com
Mon Nov 21 01:17:24 EET 2016


On Sun, Nov 20, 2016 at 10:43 AM, Mark Thompson <sw at jkqxz.net> wrote:

> On Fri, Nov 18, 2016 at 9:50 PM, Michael Goffioul <
> michael.goffioul at gmail.com <mailto:michael.goffioul at gmail.com>> wrote:
> >
> >     Hi,
> >
> >     I'm investigating the possibility to use VA-API for H264 decoding on
> Android, using Android-x86. At the moment, I'm using Android-4.4-r5 (from
> android-x86), which is based on ffmpeg-2.1. I realize this is not the
> current ffmpeg version, nervertheless I understand that 2.1 should support
> VA-API decoding.
> >
> >     I've recompiled libavcodec with support for libva (1.7.1) and I've
> added the intel driver (i965). Running vainfo on the device yields the
> following, so I assume everything is ok on that front:
>
> Probably not:
>
> >
> >     vainfo: VA-API version: 0.39 ...
>
> This is saying that the libva you linked to has API version 0.39 (i.e. it
> is libva 1.7.1).
>
> >                              ... (libva 1.1.0)
>
> While this says that the headers you have built against are from libva
> 1.1.0.
>
> >     vainfo: Driver version: Intel i965 driver for Intel(R) Bay Trail -
> 1.0.16.pre1 ()
>
> And this says that the driver loaded at run time is similarly old.
>
> >     vainfo: Supported profile and entrypoints
> >           VAProfileMPEG2Simple            :VAEntrypointVLD
> >           VAProfileMPEG2Simple            :VAEntrypointEncSlice
> >           VAProfileMPEG2Main              :VAEntrypointVLD
> >           VAProfileMPEG2Main              :VAEntrypointEncSlice
> >           VAProfileH264ConstrainedBaseline:VAEntrypointVLD
> >           VAProfileH264ConstrainedBaseline:VAEntrypointEncSlice
> >           VAProfileH264Main               :VAEntrypointVLD
> >           VAProfileH264Main               :VAEntrypointEncSlice
> >           VAProfileH264High               :VAEntrypointVLD
> >           VAProfileH264High               :VAEntrypointEncSlice
>
> So old, in fact, that it shouldn't support encoding at all - so these
> entrypoints shouldn't be here, and the fact that they are suggests
> something very strange is going on.
>
> I suggest that you fix your libva and i965 driver installation before
> proceeding with anything else.
>

The installation is fine and I'm using 1.7.1 for both libva and i965. The
version strings you're referring to are just an artifacts, because
compilation under Android doesn't use autotools. Some headers have been
generated a while back (for Android ICS) and haven't been properly kept in
sync. For the record, I'm using these repos:
https://github.com/meijjaa/vaapi-libva
https://github.com/meijjaa/vaapi-intel-driver


> On 20/11/16 01:20, Michael Goffioul wrote:
> > Basically, a little HOWTO use VA-API in ffmpeg 2.1 would be quite handy.
> Does that exist somewhere?
>
> Not really.  The usual example for this sort of thing is the support in
> the ffmpeg utility itself, but the version you have predates that (it
> existed only in libavcodec for quite a while).
>
> You could look at the current support in ffmpeg <
> http://git.videolan.org/?p=ffmpeg.git;a=blob;f=ffmpeg_vaapi.c;hb=HEAD>,
> but that uses newer API (hwcontext) around all of the frame setup, so you
> would need to write those parts as well.
>
> The media players also make use of it, so there may be some hints there:
> mpv <https://github.com/mpv-player/mpv/blob/master/video/decode/vaapi.c>
> or vlc <http://git.videolan.org/?p=vlc.git;a=blob;f=modules/
> codec/avcodec/vaapi.c;hb=HEAD>.
>

The fact is that I had assumed that the hw acceleration code in libavcodec
was self-contained. But it appeared it was not the case, and the user code
(the code using libavcodec) is actually responsible for driving the hw
acceleration setup. Eventually I found this showcase project:
https://github.com/gbeauchesne/ffvademo. It's written by the same person
who submitted the initial patches for VA-API support in ffmpeg, so I guess
it was written to demonstrate how to use it at that time. It pointed out
the fact that the user code is supposed to provide callbacks for get_format
and get_buffer2 to have HW decoding working.


> If it is possible, I think upgrading to a newer version of ffmpeg would be
> a good idea.
>

That's another option on the table.

Thanks,
Michael.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20161120/e1c0b408/attachment.html>


More information about the Libav-user mailing list