[Libav-user] Unraveling vdpau/h264 decoding

Sampsa Riikonen sampsa.riikonen at iki.fi
Tue Jun 14 19:09:01 CEST 2016


Hello,

I am trying to get my act together in order to use the h264/vdpau 
decoding features in the ffmpeg api and have a few basic questions on 
the issue..

1) First, a question on the general program flow when using vdpau. 
Please tell me when its going wrong..

When we do

avcodec_find_decoder_by_name("h264_vdpau")
avcodec_alloc_context3(codec)

Then

AVCodecContext->hwaccel [AVHWAccel]

is being populated, and when decoding h264 frames, the packet decoding 
functions in

libavcodec/h264.c

default to functions in

libavcodec/vdpau_h264.c

i.e., for example to:

vdpau_h264_decode_slice

which in turn use

libavcodec/vdpau.c

that couples to the vdpau API.

Am I getting this right?


2) I tried the "h264_vdpau" decoder, but I am getting only the following 
error messages:

[h264_vdpau @ 0x17c28a0] decode_slice_header error
[h264_vdpau @ 0x17c28a0] no frame!

On the other hand, in the same code, choosing the software decoder 
(AV_CODEC_ID_H264), works OK.
What might be going on?


3) So,

libavcodec/vdpau_h264.c

has functions that hide the vdpau api and are used by the h264 decoder.
However, in the main directory there is an interesting file called

ffmpeg_vdpau.c

that is not using functions from "libavcodec/vdpau*.c", but is directly 
using the vdpau api.
What is this file?

.. it seems that it is capable of dumping the decoded video frames 
directly to an X11 window, i.e.
decoded frames never have to leave from the GPU memory.  Is this correct?

It seems to be using

AVCodecContext->opaque->hwaccel_device

to pass the information about to which X11 window the video should be 
dumped.

Is there such possibility when using vdpau via the normal ffmpeg api, 
i.e., when using simply "h264_vdpau" decoder as a "black box" ?
In this case, what is the parameter I have to pass.. something in the 
AVCodecContext as well?

Regards,

Sampsa



More information about the Libav-user mailing list