[Libav-user] Exposing -start_number

Gonzalo Garramuño ggarra13 at gmail.com
Wed Mar 29 16:53:49 EEST 2017



El 29/03/17 a las 09:45, Gonzalo Garramuño escribió:
> I would like to use the PNG reader that comes with FFMPEG in my 
> program as it is multithreaded and quite fast. However, I don't know 
> how to set the starting frame number ( -start_number ) nor the length 
> of frames to read.  Reading img2dec.c, I found out about 
> VideoDemuxData.  Currently, the class VideoDemuxData is private to 
> libavformat, and is located in a private .h file (img2.h).  So I am 
> stumped.
>
> My question is: is there any way in libav to set the value of 
> -start_number or, more to the point, have the png reader start/end at 
> a particular frame?
>
> Thanks in advance.
>
To answer my own question:


       AVDictionary *opts = NULL;
       av_dict_set(&opts, "initial_pause", "1", 0);

       char buf[64];
       sprintf( buf, "%" PRId64, _frameStart );

       av_dict_set(&opts, "start_number", buf, 0);

       AVInputFormat*     format = NULL;
       // We must open fileroot for png sequences to work
       int error = avformat_open_input( &_context, fileroot(),
                        format, &opts );

-- 
Gonzalo Garramuño



More information about the Libav-user mailing list