<div dir="ltr"><p>Hi gentlemen,</p>
<p>We are using FFmpeg libraries git-ee94362 libavformat v55.2.100.<br>We are trying to write a simple HLS code example based on muxing.c standard one.<br>Let be two input streams, video and audio (they can be synthetic, doesn't matter). <br>
Our purpose is to mux them into M3U8 playlist using HLS. <br>Suppose, duration of every TS segment file be 3 sec, and the desirable maximum number of entries in M3U8 output file be 100. </p>
<div>From the FFmpeg application sources, one can see that the Apple HTTP Live Streaming segmenter implemented in hlsenc.c file. <br>And the relevant options there are, as well: "hls_list_size", "hls_time", etc.<br>
The problem is that we have not succeeded to set/get/find these options in a conventional way, as shown in the following code:</div>
<div> </div>
<div>// Here is a part of main() program<br>int64_t i1 = 0;<br>void *target_obj;</div>
<div>AVFormatContext *ofmt_ctx = NULL;<br>AVOutputFormat *ofmt = NULL;</div>
<div> </div>
<div>avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, "Example_Out.m3u8");</div>
<div>ofmt = ofmt_ctx->oformat;</div>
<div> </div>
<div>// The relevant options ("hls_list_size", "hls_time") are located under ofmt->priv_class->option.<br>// But AVClass *priv_class is not the first member of the AVOutputFormat.<br>// So, due to the documentation, av_opt_find...(), av_opt_get...() and av_opt_set...() <br>
// cannot be used for options within AVOutputFormat.<br>// In practice, any of the following three lines causes exception.<br>const AVOption *o = av_opt_find2(ofmt, "segment_list_size", NULL, 0, AV_OPT_SEARCH_CHILDREN, &target_obj);<br>
av_opt_get_int(ofmt, "segment_list_size", AV_OPT_SEARCH_CHILDREN, &i1);<br>av_opt_set_int(ofmt, "segment_list_size", 10, AV_OPT_SEARCH_CHILDREN);</div>
<div><br>Our question: If there is a way to overcome the problem, i.e. to set/get/find options for AVOutputFormat, like for AVCodecContext (for example)?</div>
<div> </div>
<div>Thank you,<br>Andrey Mochenov. </div></div>