[Libav-user] Using Video Toolbox hardware decoding

Info || Non-Lethal Applications info at non-lethal-applications.com
Fri Oct 23 20:55:40 CEST 2015


Jörgen,

> On 22 Oct 2015, at 16:50, Isaksson Jörgen <jogga at bitfield.se> wrote:
> 
> Hi all,
> 
> I’m new to this list so forgive me if this has been answered before.
> 
> With version 2.8 of the libraries I saw the addition of Video Toolbox hardware decoding support (on Mac OS X that is).
> 
> But I can’t find much documentation on how to use it. There are some clues in the header files on how to set it up, but there’s no docs on how to do the actual decoding.
> 
> I have compiled version 2.8.1 of the libraries and I can confirm that the Video Toolbox hwaccels are there:
> 
> Enabled hwaccels:
> h263_videotoolbox	mpeg1_videotoolbox	mpeg4_videotoolbox
> h264_videotoolbox	mpeg2_videotoolbox
> 
> In my player app I have setup an AVVideotoolboxContext like described in the headers. 
> 
> if (self.codecContext->codec_id == AV_CODEC_ID_H264) {
>        _videoToolboxContext = av_videotoolbox_alloc_context();
>        int result = av_videotoolbox_default_init2(self.codecContext, self.videoToolboxContext);
>        if (result != 0) {
>            NSLog(@"Failed to init video toolbox");
>            _videoToolboxContext = NULL;
>        }
> }
> 
> _codec = avcodec_find_decoder(self.codecContext->codec_id);
> 
> Everything seems to work fine and the _videoToolboxContext is properly allocated.
> 
> But how do I go about actually decoding using it?
> 
> Anyone with any experience from this?

It was my understanding that VideoToolbox hardware acceleration is used for you automatically when it is enabled and available.
I think this was also confirmed here a while ago (I can’t happen to find the email right now…).
Looking further down in videotoolbox.c you see a couple of structures filled with function pointers.

I think this is the way libavcodec supports all the different formats.
There are some guys on the mailing list here that know better though.
So please feel free to correct me if I’m wrong!

Best,

Flo

> best regards / Jörgen Isaksson
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user



More information about the Libav-user mailing list