[Libav-user] Using avformat_open_input with an image sequence that doesn't start at zero

Jon Noble jonnobleuk at gmail.com
Fri Jan 31 11:40:29 EET 2020


On 30/01/2020 23:05, gga wrote:
>
> On 30/1/20 18:50, Jonathan Noble wrote:
>>
>> What must I do to open an image sequence that doesn't start at zero?
>>
> AVDictionary* opts = NULL;
>
> char buf[64];
>
> int64_t frameStart = 20; // your number goes here
>
> sprintf( buf, "%" PRId64, frameStart );
> av_dict_set(&opts, "start_number", buf, 0);
Thanks. That worked great.
> // Set:
> // AVFormatContext* _context;           //!< current read file context
> // Set fileroot() to your image full pathname, like: /mydir/test.%04d.exr
>
> int err = avformat_open_input( &_context, fileroot(),
>                                 NULL, &opts );
>
> // Use av_read_frame() and others as usual.
>


More information about the Libav-user mailing list