[Libav-user] How to get the last frame from a filter graph?
corey.taylor.fl at gmail.com
Tue Jan 23 10:12:51 EET 2018
On Tue, Jan 23, 2018 at 2:04 AM, Tobias Rapp <t.rapp at noa-archive.com> wrote:
> in my application I have problems getting the last frame out of a filter
> graph when the filter chain includes the yadif filter. The application is
> based on the filtering_video.c example and I can reproduce it when adding
> the yadif filter there (see attached file).
> How can I make sure to always get all the frames out of a filter graph?
You can call av_buffersrc_add_frame_flags with NULL for the frame
which will signal the end of stream.
Then you can loop through av_buffersink_get_frame until it returns
AVERROR_EOF (or any error).
The loop would typically be:
1. Call av_buffersink_get_frame
2. If no error, process frame
3. if AVERROR_EOF, end your stream
avcodec_send_frame will do the same with a NULL for the frame to
trigger flushing the codec the same as the filter graph.
More information about the Libav-user