[Libav-user] Exposing -start_number

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Libav-user] Exposing -start_number

Gonzalo Garramuño
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.

--
Gonzalo Garramuño

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Exposing -start_number

Gonzalo Garramuño


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

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Loading...