[Libav-user] [libav-user] How use "reset_timestamps" and "segment_time" options

Strahinja Radman dr.strashni at gmail.com
Wed Jan 29 08:45:50 EET 2020


>
>
> In this case, I need the two options "reset_timestamps" and "segment_time".
>

reset_timestamps is the option that you have to implement by yourself.
Simply subtract the value of the first
packet DTS /PTS per each stream and you will effectively reset timestamps
to zero.

segment_time is HLS option, and if you want to set these options on the
output file use this code:

avformat_alloc_output_context2(&ofmt_ctx, NULL, "hls", "output.m3u8");
AVDictionary* headerOptions = NULL;

av_dict_set(&headerOptions, "hls_segment_type", "fmp4", 0);
av_dict_set(&headerOptions, "hls_playlist_type", "event", 0);
av_dict_set(&headerOptions, "hls_flags", "append_list", 0);
av_dict_set_int(&headerOptions, "hls_list_size", hls_list_size, 0);
av_dict_set(&headerOptions, "segment_time_delta",
to_string(hls_segment_time_delta), 0);
av_dict_set(&headerOptions, "hls_time", to_string(hls_segment_duration), 0);
av_dict_set(&headerOptions, "hls_fmp4_init_filename", init_segment_name, 0);

avformat_write_header(oc->ofmt_ctx, &headerOptions);
-- 

Regards
Strahinja Radman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200129/675cb5ff/attachment.html>


More information about the Libav-user mailing list