[FFmpeg-devel] FFmpeg A/V filtering questions

Clément Bœsch ubitux at gmail.com
Tue Feb 14 16:43:55 CET 2012


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.

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?

> > 6) libavdevice/lavfi.c seems to have a similar code to
> >    avfilter_fill_frame_from_video_buffer_ref(); why is it handled differently
> >    than in ffmpeg.c?
> 
> Different data paths.
> 
> ffmpeg.c:transcode_video():
> get a buffer ref from the filterchain, convert it to an AVFrame, pass
> it to do_video_out(), do_video_out() performs more magic on the frame,
> passes it to the encoder and to write_frame() (which performs muxing)
> 
> lavfi.c/lavfi_read_packet()
> get the buffer ref from the sink buffer, and assemblate a raw video
> packet directly from the video data
> 

I see, OK.

Thank you very much :)

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120214/f943aec5/attachment.asc>


More information about the ffmpeg-devel mailing list