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