<div dir="ltr"><div>Hi,</div>
<div> </div>
<div>Thank you for your answer.</div>
<div>I suppose, IDR stands for <span lang="HE">Instantaneous Decoding Refresh.</span></div>
<div><span lang="HE">
<div>Please, explain: what do you mean under "set encoder with all idr"? </div></span><br>What settings I need to use?</div>
<div> </div>
<div>Andrey.</div>
<div> </div></div>
<div class="gmail_quote">On Mon, Aug 19, 2013 at 10:48 AM, Anshul maheshwari <span dir="ltr"><<a href="mailto:er.anshul.maheshwari@gmail.com" target="_blank">er.anshul.maheshwari@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<p>
<div>
<div class="h5">
<p>Please dont top post over here </p>
<p>Try to set encoder with all idr,  that may give you const duration</p></div></div></p></blockquote>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>
<div class="h5">
<p>On Aug 15, 2013 4:59 PM, "Andrey Mochenov" <<a href="mailto:andrey2067@gmail.com" target="_blank">andrey2067@gmail.com</a>> wrote:<br>><br>> Hi,<br>><br>> We are using FFmpeg libraries git-ee94362 libavformat v55.2.100.<br>
> Our purpose is to mux two streams (video and audio) into M3U8 playlist using HLS.<br>> In addition, we want the duration of every TS segment file be exactly 3.0 sec (frame rate is 25 fps).<br>> To reach it, we are trying to set several options and properties, namely: <br>
> - segment_time  <br>> - keyint_min<br>> - scenechange_threshold<br>> - gop_size<br>> - force_key_frames.<br>><br>> And our code looks as below:<br>><br>> AVCodecContext *codec_ctx = NULL;<br>> AVFormatContext *ofmt_ctx = NULL;<br>
> int ret = 0, gopSize = (int)(3.0 * 25);   // 3 sec * 25 fps<br>><br>> // ofmt_ctx and codec_ctx initialization and filling are OK, but:<br>><br>> codec_ctx->time_base.num = 1;<br>> codec_ctx->time_base.den = 25 // fps<br>
><br>> // It seems, that the following three lines have no effect without explisit setting of the "hls_time" property<br>> codec_ctx->keyint_min = gopSize;       // in FFMpeg application, the corresponding option is "-keyint_min 3"<br>
> codec_ctx->scenechange_threshold = 0;  // in FFMpeg application, the corresponding option is "-sc_threshold 0"<br>> codec_ctx->gop_size = gopSize;         // in FFMpeg application, the corresponding option is "-g 3"<br>
><br>> ret = av_opt_set_double(ofmt_ctx, "hls_time", 3.0, AV_OPT_SEARCH_CHILDREN);<br>><br>> // Any of the following lines causes "Option not found" error.<br>> ret = av_opt_set(codec_ctx->priv_data, "profile", "main", AV_OPT_SEARCH_CHILDREN);<br>
> ret = av_opt_set(codec_ctx->priv_data, "preset", "ultrafast", AV_OPT_SEARCH_CHILDREN);<br>> ret = av_opt_get(ofmt_ctx, "segment_time",  AV_OPT_SEARCH_CHILDREN, &str);<br>> ret = av_opt_set((ofmt_ctx, "segment_time", "3.0", AV_OPT_SEARCH_CHILDREN);<br>
><br>> Anyway, the TS files durations are different, (~2-3 sec), and not EXACTLY 3.0 sec. <br>> Our question: What is the best way to solve the problem?<br>><br>> Andrey Mochenov.<br>><br>><br></p></div>
</div>> _______________________________________________<br>> Libav-user mailing list<br>> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>

<p></p>
<p>Please dont top post over here </p>
<p>Try to set encoder with all idr,  that may give you const duration</p><br>_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br><br></blockquote></div><br>