[Libav-user] How to detect 9/10 bits video?
nfxjfg at googlemail.com
Fri May 2 14:24:23 CEST 2014
On Fri, 2 May 2014 12:43:53 +1000
Jean-Yves Avenard <jyavenard at gmail.com> wrote:
> On 1 May 2014 19:45, wm4 <nfxjfg at googlemail.com> wrote:
> > Use the video's profile. Alternatively, you can try to setup the
> > AVCodecContext to do vdpau decoding, which will fail if the video is
> > 9/10 bit (it will try to fallback to software decoding, which you can
> > detect). But note that there are 8 bit videos which can't be decoded
> > with most hw decoders, so the profile should be checked too.
> Thank for your answer.
> Unfortunately, it's not quite so easy...
> opening AVCodecContext for VDPAU playback with 9/10 bits video doesn't fail.
> It's only when you attempt to decode the video frame that it will and
> by this time it's too late as everything as been set for vdpau.
True... works for me anyway, since it happens on the first packet, not
the first decoded frame.
> I wanted to find a way early on, and would prefer not to test for just
> the profile as I'm sure there will be others that will fail and I
> can't think of right now...
> Any ideas on how to make sure opening the stream, context or codec
> that will cause it to fail early?
Well, I think libavformat will set the profile correctly when opening
the input (AVStream->codec->profile). As of recently, you can also use
the function av_vdpau_get_profile() to convert the ffmpeg profile value
to a vdpau profile value. Since there's currently no vdpau profile
defined for 9/10 bit video, this function will fail in that case.
More information about the Libav-user