[Libav-user] HLS options problem

Andrey Mochenov andrey2067 at gmail.com
Tue Aug 13 10:38:48 CEST 2013

Hi gentlemen,

We are using FFmpeg libraries git-ee94362 libavformat v55.2.100.
We are trying to write a simple HLS code example based on muxing.c standard
Let be two input streams, video and audio (they can be synthetic, doesn't
Our purpose is to mux them into M3U8 playlist using HLS.
Suppose, duration of every TS segment file be 3 sec, and the desirable
maximum number of entries in M3U8 output file be 100.
>From the FFmpeg application sources, one can see that the Apple HTTP Live
Streaming segmenter implemented in hlsenc.c file.
And the relevant options there are, as well: "hls_list_size", "hls_time",
The problem is that we have not succeeded to set/get/find these options in
a conventional way, as shown in the following code:

// Here is a part of main() program
int64_t i1 = 0;
void *target_obj;
AVFormatContext *ofmt_ctx = NULL;
AVOutputFormat *ofmt = NULL;

avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, "Example_Out.m3u8");
ofmt = ofmt_ctx->oformat;

// The relevant options ("hls_list_size", "hls_time") are located under
// But AVClass *priv_class is not the first member of the AVOutputFormat.
// So, due to the documentation, av_opt_find...(), av_opt_get...() and
// cannot be used for options within AVOutputFormat.
// In practice, any of the following three lines causes exception.
const AVOption *o = av_opt_find2(ofmt, "segment_list_size", NULL,
0,  AV_OPT_SEARCH_CHILDREN, &target_obj);
av_opt_get_int(ofmt, "segment_list_size", AV_OPT_SEARCH_CHILDREN, &i1);
av_opt_set_int(ofmt, "segment_list_size", 10, AV_OPT_SEARCH_CHILDREN);

Our question: If there is a way to overcome the problem, i.e. to
set/get/find options for AVOutputFormat, like for AVCodecContext (for

Thank you,
Andrey Mochenov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130813/a27f7dd6/attachment.html>

More information about the Libav-user mailing list