[FFmpeg-devel] FFmpeg A/V filtering questions

Stefano Sabatini stefasab at gmail.com
Wed Feb 15 00:15:00 CET 2012


On date Tuesday 2012-02-14 16:43:55 +0100, Clément Bœsch encoded:
> On Tue, Feb 14, 2012 at 04:23:26PM +0100, Stefano Sabatini wrote:
> [...]
> > > 4) why is there an exception for the sample aspect ratio since
> > >    avfilter_fill_frame_from_video_buffer_ref() will actually do that
> > >    copy?
> > 
> >     if (ost->picref->video && !ost->frame_aspect_ratio)
> >         ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio;
> > 
> > This is copying the sample_aspect_ratio to the stream context if it is
> > not defined in ost, ost->picref->video->sample_aspect_ratio is
> > equivalent to filtered_frame->sample_aspect_ratio, also maybe the code
> > should be moved to do_video_out(), note that I tried to keep the
> > setting logic unchanged when I introduced
> > avfilter_fill_frame_from_video_buffer_ref().
> > 
> 
> OK. I'll send a patch to move it eventually.
> 
> > > 5) what is the audio equivalent for
> > >    avfilter_fill_frame_from_video_buffer_ref()? According to
> > >    libavdevice/lavfi.c, it seems to only need the data memcpy() and a few
> > >    props copy.
> > 
> > The code in lavfi.c predates the audio-in-AVFrame changes, the right
> > solution would consist now into adding
> > avfilter_fill_frame_from_audio_buffer_ref() *or* even better
> > generalize the function:
> > avfilter_fill_frame_from_video_buffer_ref -> avfilter_fill_frame_from_buffer_ref
> > 
> 

> Or both? It will allow "optimized" audio or video calls, or a generic one
> if the calling code is generically designed. It will also avoid the need
> of a major bump to drop the video function.

Possible, extra brownie points if you can devise a simple way to avoid
code duplication->busty logic in case of struct extension.

> Now what is supposed to be in for audio? From what I can see, it seems I have to
> copy the ref->data, ref->format, and ref->audio->nb_samples. Is that all?

I think so.
-- 
FFmpeg = Forgiving and Fascinating Meaningful Pacific Extended Generator


More information about the ffmpeg-devel mailing list