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

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Jonathan Noble
Hi,

I can open an image sequence that starts at zero using avformat_open_input successfully.
However, for an image sequence that starts beyond zero, ffmpeg doesn't find the sequence.

Presumably the start number is required, just like with the ffmpeg cli program, but I cannot find any documentation on how to do this via the library.

What must I do to open an image sequence that doesn't start at zero?

Kind regards.

Jon Noble

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

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using avformat_open_input with an image sequence that doesn't start at zero

Carl Eugen Hoyos-2
Am Do., 30. Jan. 2020 um 22:56 Uhr schrieb Jonathan Noble
<[hidden email]>:

> I can open an image sequence that starts at zero using avformat_open_input successfully.
> However, for an image sequence that starts beyond zero, ffmpeg doesn't find the sequence.

See -start_number and -start_number_range

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using avformat_open_input with an image sequence that doesn't start at zero

Jonathan Noble


On Thu, 30 Jan 2020 at 22:11, Carl Eugen Hoyos <[hidden email]> wrote:
Am Do., 30. Jan. 2020 um 22:56 Uhr schrieb Jonathan Noble
<[hidden email]>:

> I can open an image sequence that starts at zero using avformat_open_input successfully.
> However, for an image sequence that starts beyond zero, ffmpeg doesn't find the sequence.

See -start_number and -start_number_range
Yes. I stated that argument exists in the ffmpeg cli. So I know it exists. My question was about the library.
Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using avformat_open_input with an image sequence that doesn't start at zero

Carl Eugen Hoyos-2
Am Do., 30. Jan. 2020 um 23:34 Uhr schrieb Jonathan Noble
<[hidden email]>:

>
>
>
> On Thu, 30 Jan 2020 at 22:11, Carl Eugen Hoyos <[hidden email]> wrote:
>>
>> Am Do., 30. Jan. 2020 um 22:56 Uhr schrieb Jonathan Noble
>> <[hidden email]>:
>>
>> > I can open an image sequence that starts at zero using avformat_open_input successfully.
>> > However, for an image sequence that starts beyond zero, ffmpeg doesn't find the sequence.
>>
>> See -start_number and -start_number_range
>
> Yes. I stated that argument exists in the ffmpeg cli. So I know it exists. My question was about the library.

The argument is not related to the cli.

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using avformat_open_input with an image sequence that doesn't start at zero

James
In reply to this post by Jonathan Noble
On Thu, 30 Jan 2020 at 22:34, Jonathan Noble <[hidden email]> wrote:


On Thu, 30 Jan 2020 at 22:11, Carl Eugen Hoyos <[hidden email]> wrote:
Am Do., 30. Jan. 2020 um 22:56 Uhr schrieb Jonathan Noble
<[hidden email]>:

> I can open an image sequence that starts at zero using avformat_open_input successfully.
> However, for an image sequence that starts beyond zero, ffmpeg doesn't find the sequence.

See -start_number and -start_number_range
Yes. I stated that argument exists in the ffmpeg cli. So I know it exists. My question was about the library.
Carl Eugen
_______________________________________________


You can pass an AVDictionary with the options that the Demuxer would be passed when opened. It's the fourth parameter of avformat_open_input(). 

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

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using avformat_open_input with an image sequence that doesn't start at zero

Gonzalo Garramuño
In reply to this post by Jonathan Noble

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);


// 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.

--
Gonzalo Garramuño

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

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using avformat_open_input with an image sequence that doesn't start at zero

Jonathan Noble

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.
>
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".