dicroce
dicroce

Reputation: 46800

How do you set muxer options in libavformat?

I'm trying to use the libavformat muxer "hlsenc.c".... Looking through the code of the muxers, it looks like muxers support paramaters via the AVOption mechanism... For example, the hlsenc.c muxer supports an AVOption parameter called "hls_time"...

I'm using av_guess_format("hls",NULL,NULL) to find the appropriate output format, but how do you set these options?

(it seems like all the samples on the internet are setting options on a codec... I want to set options on a muxer).

Upvotes: 3

Views: 2879

Answers (2)

Alan Birtles
Alan Birtles

Reputation: 36469

Muxer options can be passed to the second argument of avformat_write_header

Upvotes: 3

Wagner Patriota
Wagner Patriota

Reputation: 5674

  1. use avformat_alloc_output_context2() to guess the format for you.
  2. then use avio_open2() to open the files. avio_open2() is the "modern way" your are looking for.

As you can see, it has the options parameter.

int avio_open2( AVIOContext **s,
                const char *url,
                int flags,
                const AVIOInterruptCB *int_cb,
                AVDictionary **options ); // \o/

Upvotes: 2

Related Questions