[Libav-user] Direct rendering or avoiding copying locally a decoded AVFrame before rendering

Bruce Wheaton bruce at spearmorgan.com
Fri Nov 29 23:42:43 CET 2013


On Oct 7, 2013, at 9:34 AM, Julian Herrera (TVGenius) <julian.herrera at tvgenius.net> wrote:

> Hi Paul and wm4,
> 
> Thank you for your support. I realised I just needed to activate reference counting, so I set
> 
> AVCodecContext->refcounted_frames = 1;
> 
> before avcodec_open2() and then it worked! I do not have to copy the decoded frames locally any more so the process is more efficient now.

Julian, I'm looking to do the same, now I see it's easier (I failed with the get buffer approach, especially since it conflicted with multithreading).

What function are you using to create a new avframe? Do you create a new one every time you call to decode?

Bruce

> 
> Thank you again!
> 
> Regards,
> Julian Herrera
> 
> On 7 Oct 2013, at 16:55, wm4 <nfxjfg at googlemail.com> wrote:
> 
>> On Mon, 7 Oct 2013 15:22:19 +0000
>> Paul B Mahol <onemda at gmail.com> wrote:
>> 
>>> On 10/7/13, Julian Herrera (TVGenius) <julian.herrera at tvgenius.net> wrote:
>>>> I do not use reference counting indeed. I could not find an example on the
>>>> Internet on how to use it.
>>> 
>>> https://github.com/mpv-player/mpv/blob/master/video/decode/vd_lavc.c
>> 
>> I think he wants to software-decode into a user-provided AVFrame, which
>> this code does _not_ do. (It does only for hardware decoding - and for
>> old libavcodec versions which didn't have native reference counting
>> yet. I guess the hw decoding case could actually be applied to
>> software decoding too, but it still doesn't make an ideal example.)
>> 
>> Anyway, he want to override get_frame2. I'm not sure if that strictly
>> _requires_ reference counting, but maybe it's a good idea to use and
>> enable it.
>> 
>>> doc/examples/filtering_audio.c
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/libav-user
>> 
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
> 
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user



More information about the Libav-user mailing list