[Libav-user] difference between various h264 codec...

wm4 nfxjfg at googlemail.com
Sun May 4 11:12:57 CEST 2014


On Sun, 4 May 2014 01:52:35 +1000
Jean-Yves Avenard <jyavenard at gmail.com> wrote:

> Hi
> 
> On 4 May 2014 00:21, wm4 <nfxjfg at googlemail.com> wrote:
> 
> > There is no h264_vdpau codec anymore (except maybe the old legacy
> > implementation that was removed from Libav, but not FFmpeg yet).
> > Instead, you're supposed to use the hwaccel feature.
> 
> Great !
> 
> I've spent hours attempting to change that, because I was concerned I
> wasn't doing it the proper way :)
> 
> >
> > This is the defacto-documentation how to use it:
> >
> > https://git.videolan.org/?p=ffmpeg.git;a=blob;f=ffmpeg_vdpau.c
> 
> seriously? that's the "documentation" :)

Since the interaction is pretty complicated, and the code is relatively
clear, this state isn't that bad. It's better than it was before there
was no example code at all.

> >
> > The trick is that you open the normal h264 codec, but select a vdpau
> > pixelformat when the get_format callback is used.
> 
> Originally, I was returning (as part of the old code legacy), the
> pixelformat directly related to the codec:
> e.g: returning AV_PIX_FMT_VDPAU_H264. But this cause h264 playback to fail.
> so I now always return AV_PIX_FMT_VDPAU in my get_format.

AV_PIX_FMT_VDPAU is what you use with the new API. The codec specific ones
are for the old API and won't work with the new API.

> Interestingly, when I do like what everyone else appear to be doing, like:
>     while(*cur != PIX_FMT_NONE)
>     {
>         if (*cur == AV_PIX_FMT_VDPAU)
>             return *cur;
>         cur++;
>     }
>     return avcodec_default_get_format(avctx, fmt);
> 
> for WMP3, the PixelFormat received is AV_PIX_FMT_VDPAU_WMP3, but
> there's no AV_PIX_FMT_VDPAU in the list that follows. Wrong order in
> the pixel format is my guess.
> 
> (this is what XBMC essentially does)

Sounds like you're still using the old decoder?

> >
> > I don't know what they're doing currently, but they still could be
> > using the "old" API, or emulating it.
> 
> hmmm... looking at it, they are definitely using the new API..
> 
> 
> > Well, there's nothing magic about the "new" API, it's just the old one
> > slightly changed. I still have no idea why it was changed at all.
> 
> there must be something different.

Well yes, some things are different. You also have to provide a vdpau
context struct, and you don't override the avcodec slice callback.

> I have a few mpeg2 video that do not play with the old API, but do now.
> like the one reported here:
> https://code.mythtv.org/trac/ticket/11377

Well, the old API was "restored" after it was removed (because
Libav removed it, but then a MPlayer developer readded it to
FFmpeg - or actually, I'm not sure what exactly happened), so maybe
there's a potential for bugs. But AFAIK MPlayer devs actually fixed a
few bugs in the _new_ API so that it works as good as the old one.

> thanks again for you help... much appreciated
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user



More information about the Libav-user mailing list