[FFmpeg-devel] avfilter_graph Question
Ganesh Ajjanagadde
gajjanag at mit.edu
Thu Oct 15 03:38:41 CEST 2015
On Wed, Oct 14, 2015 at 4:48 PM, Grady Player
<grady.player at verizondigitalmedia.com> wrote:
> the doxygen, docs dont really point to any difference… (the prototype for av_buffersrc_add_frame doesn’t match my header, not sure if that is a version issue)
Must have been the av_warn_unused_result I added recently - no need to
worry about that: it is really for user's benefit so that they check
the return codes correctly (GCC should emit a -Wunused-result error
when the return code is not used/checked).
I will look into the docs soon: there is some difference, "add a
frame" and "add frame data" are IMO clearly different things. Any
concrete rewordings based on your experience are welcome.
>
> int av_buffersrc_write_frame ( AVFilterContext * s, const AVFrame * frame )
> Add a frame to the buffer source.
>
> int av_buffersrc_add_frame (AVFilterContext *buffer_src, const AVFrame *frame, int flags)
> Add frame data to buffer_src.
>
>
> On Oct 14, 2015, at 2:15 PM, Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
>
>> On Wed, Oct 14, 2015 at 4:13 PM, Grady Player
>> <grady.player at verizondigitalmedia.com> wrote:
>>> Figured it out, sharing (if anyone were to care)…
>>>
>>> I was using
>>> av_buffersrc_add_frame
>>> rather than:
>>> av_buffersrc_write_frame
>>>
>>> which informs the buffer to retain an internal reference to the original picture/frame..
>>
>> Was the documentation confusing? Any suggestions for improving the docs?
>>
>>>
>>> -Grady
>>>
>>>
>>> On Oct 14, 2015, at 11:50 AM, Grady Player <grady.player at verizondigitalmedia.com> wrote:
>>>
>>>> Yes, sorry this was omitted - after I am done I call:
>>>>
>>>> av_frame_free(&oframe);
>>>>
>>>> it seems to be something that is internally referenced by the graph...
>>>>
>>>>
>>>> On Oct 14, 2015, at 10:50 AM, Paul B Mahol <onemda at gmail.com> wrote:
>>>>
>>>>> Dana 14. 10. 2015. 17:36 osoba "Grady Player" <
>>>>> grady.player at verizondigitalmedia.com> napisala je:
>>>>>>
>>>>>> Currently using:
>>>>>>
>>>>>> commit af5917698bd44f136fd0ff00a9e5f8b5f92f2d58
>>>>>> Author: Michael Niedermayer <michaelni at gmx.at>
>>>>>> Date: Sun May 17 01:34:35 2015 +0200
>>>>>>
>>>>>> I am trying to set up a small filter graph in order to use the YADIF
>>>>> implementation in libavfilter...
>>>>>>
>>>>>> I have set up an avfilter_graph with 3 filters…
>>>>>>
>>>>>> avfilter_register_all();
>>>>>> avfGraph = avfilter_graph_alloc();
>>>>>>
>>>>>> AVFilter * bufferFilter, * yadifFilter, * bufferSink;
>>>>>>
>>>>>> bufferFilter = avfilter_get_by_name("buffer");
>>>>>> yadifFilter = avfilter_get_by_name("yadif");
>>>>>> bufferSink = avfilter_get_by_name("buffersink”);
>>>>>>
>>>>>> /* dynamic configuration here */
>>>>>>
>>>>>> avfilter_graph_create_filter(/*done for each filter */);
>>>>>>
>>>>>> if (err >= 0) err = avfilter_link(buffer_ctx, 0, yadif_ctx, 0);
>>>>>> if (err >= 0) err = avfilter_link(yadif_ctx, 0, sink_ctx, 0);
>>>>>>
>>>>>> if (err>=0) err = avfilter_graph_config(avfGraph, NULL);
>>>>>>
>>>>>>
>>>>>> Then I feed frames into the graph with:
>>>>>>
>>>>>> err = av_buffersrc_add_frame(buffer_ctx, avf);
>>>>>>
>>>>>> and pull frames out of the graph with:
>>>>>>
>>>>>> AVFrame * oframe = av_frame_alloc();
>>>>>> err = av_buffersink_get_frame(sink_ctx, oframe);
>>>>>>
>>>>>>
>>>>>> this all seems to work pretty well, except it is holding on to a lot of
>>>>> memory that is released in avfilter_graph_free()
>>>>>>
>>>>>> I suspect it is something dumb, but is there something I need to be doing
>>>>> to release internal references to some resource?
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> Do you free frame you no longer need?
>>>>> _______________________________________________
>>>>>> ffmpeg-devel mailing list
>>>>>> ffmpeg-devel at ffmpeg.org
>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>> _______________________________________________
>>>>> ffmpeg-devel mailing list
>>>>> ffmpeg-devel at ffmpeg.org
>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>
>>>
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list