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 < [email protected]> 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 > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user >
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
