[Libav-user] How to favor hardware codec when decoding
Leandro Moreira
leandro.ribeiro.moreira at gmail.com
Tue Nov 21 23:03:45 EET 2017
I think you can use these two functions: avcodec_find_encoder_by_name(name)
and avcodec_find_decoder_by_name(name) but they require you to know your
decoder name before (ffmpeg -decoders).
On Tue, Nov 21, 2017 at 5:16 PM Jacob Trimble <
modmaker-at-google.com at ffmpeg.org> wrote:
> I am writing an application using libavcodec to decode content (which
> is also using libavformat to demux). If the platform supports it, I
> want to use a hardware decoder if possible, but avcodec_find_decoder
> always returns the software decoder.
>
> For example, when decoding h264, on Linux I want to use the
> "h264_cuvid" decoder, on Mac/iOS I want to use the "h264" decoder with
> the AV_HWDEVICE_TYPE_VIDEOTOOLBOX hwaccel, on others I want to use the
> normal "h264" software decoder.
>
> I can use av_hwdevice_iterate_types to find the first hwaccel for the
> system; but that may not support the current codec, while another
> might (if there are multiple). Also, it doesn't allow me to get
> "h264_cuvid" on Linux.
>
> I also tried using the codec name as a prefix (i.e. looking for any
> supported codec that starts with "h264_"). But this doesn't work with
> "aac" since there is "aac_latm". I also can't use the hwdevice name
> since that would be "cuda" on Linux, not "cuvid".
>
> I want to avoid hard-coding any of these mappings or using hacky
> string manipulation that depends on the name of the codec. Is there a
> way to get a hardware codec for some codec ID/name? Is there a way to
> detect if a given hwdevice supports some codec (e.g. does videotoolbox
> support "vp9")?
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20171121/533e2c66/attachment.html>
More information about the Libav-user
mailing list