[Libav-user] How ffmpeg insert/drop frames when applying pts filter?

Shu Wang halfelf.ronin at gmail.com
Thu Jul 28 13:46:45 EEST 2016


Hello everyone,

  I'd like to use libav* to speed up/slow down videos. The same function in
command line:

        ffmpeg -i somevideo.mp4 -vf 'setpts=3*PTS' frames_%04d.jpg
        ffmpeg -i somevideo.mp4 -vf 'setpts=0.1*PTS' frames_%04d.jpg

  Since the "-vf" option means "video filter", I started testing with
examples/filtering_video.c, and configured my filter graph with the same
filter str like above :

         // I just modified the codes from examples/filtering_video.c
         avfilter_graph_parse_ptr(filter_graph, "setpts=0.1*PTS", &inputs,
&outputs, NULL);
         avfilter_graph_config(filter_graph, NULL);

  Turns out this will only set the pts field of AVFrame.  However the
`ffmpeg` command-line tool will insert/drop some frames to keep fps
unchanged.  Maybe it just drop some frames evenly when speeding up, but how
does it generate new frames when slow down?

  Much appreciated if anyone could show me where in the source ffmpeg
inserts/drop those frames, or how to do it on my own.

-- 
Regards,
Shu Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160728/8ba06c1c/attachment.html>


More information about the Libav-user mailing list