<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Nov 20, 2016 at 10:43 AM, Mark Thompson <span dir="ltr"><<a href="mailto:sw@jkqxz.net" target="_blank">sw@jkqxz.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Fri, Nov 18, 2016 at 9:50 PM, Michael Goffioul <<a href="mailto:michael.goffioul@gmail.com">michael.goffioul@gmail.com</a> <mailto:<a href="mailto:michael.goffioul@gmail.com">michael.goffioul@<wbr>gmail.com</a>>> wrote:<br>
><br>
>     Hi,<br>
><br>
>     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.<br>
><br>
>     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:<br>
<br>
</span>Probably not:<br>
<br>
><br>
>     vainfo: VA-API version: 0.39 ...<br>
<br>
This is saying that the libva you linked to has API version 0.39 (i.e. it is libva 1.7.1).<br>
<br>
>                              ... (libva 1.1.0)<br>
<br>
While this says that the headers you have built against are from libva 1.1.0.<br>
<span class="gmail-"><br>
>     vainfo: Driver version: Intel i965 driver for Intel(R) Bay Trail - 1.0.16.pre1 ()<br>
<br>
</span>And this says that the driver loaded at run time is similarly old.<br>
<span class="gmail-"><br>
>     vainfo: Supported profile and entrypoints<br>
>           VAProfileMPEG2Simple            :VAEntrypointVLD<br>
>           VAProfileMPEG2Simple            :VAEntrypointEncSlice<br>
>           VAProfileMPEG2Main              :VAEntrypointVLD<br>
>           VAProfileMPEG2Main              :VAEntrypointEncSlice<br>
>           VAProfileH264ConstrainedBaseli<wbr>ne:VAEntrypointVLD<br>
>           VAProfileH264ConstrainedBaseli<wbr>ne:VAEntrypointEncSlice<br>
>           VAProfileH264Main               :VAEntrypointVLD<br>
>           VAProfileH264Main               :VAEntrypointEncSlice<br>
>           VAProfileH264High               :VAEntrypointVLD<br>
>           VAProfileH264High               :VAEntrypointEncSlice<br>
<br>
</span>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.<br>
<br>
I suggest that you fix your libva and i965 driver installation before proceeding with anything else.<br></blockquote><div><br></div><div>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:</div><div><a href="https://github.com/meijjaa/vaapi-libva">https://github.com/meijjaa/vaapi-libva</a><br></div><div><a href="https://github.com/meijjaa/vaapi-intel-driver">https://github.com/meijjaa/vaapi-intel-driver</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 20/11/16 01:20, Michael Goffioul wrote:<br>
> Basically, a little HOWTO use VA-API in ffmpeg 2.1 would be quite handy. Does that exist somewhere?<br>
<br>
</span>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).<br>
<br>
You could look at the current support in ffmpeg <<a href="http://git.videolan.org/?p=ffmpeg.git;a=blob;f=ffmpeg_vaapi.c;hb=HEAD" rel="noreferrer" target="_blank">http://git.videolan.org/?p=<wbr>ffmpeg.git;a=blob;f=ffmpeg_<wbr>vaapi.c;hb=HEAD</a>>, but that uses newer API (hwcontext) around all of the frame setup, so you would need to write those parts as well.<br>
<br>
The media players also make use of it, so there may be some hints there: mpv <<a href="https://github.com/mpv-player/mpv/blob/master/video/decode/vaapi.c" rel="noreferrer" target="_blank">https://github.com/mpv-<wbr>player/mpv/blob/master/video/<wbr>decode/vaapi.c</a>> or vlc <<a href="http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/vaapi.c;hb=HEAD" rel="noreferrer" target="_blank">http://git.videolan.org/?p=<wbr>vlc.git;a=blob;f=modules/<wbr>codec/avcodec/vaapi.c;hb=HEAD</a>><wbr>.<br></blockquote><div><br></div><div>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: <a href="https://github.com/gbeauchesne/ffvademo">https://github.com/gbeauchesne/ffvademo</a>. 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.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If it is possible, I think upgrading to a newer version of ffmpeg would be a good idea.<br></blockquote><div><br></div><div>That's another option on the table.</div><div><br></div><div>Thanks,</div><div>Michael.</div><div><br></div></div></div></div>