Open ekimekim opened 5 months ago
OBS relies on strftime
for putting timestamps into it's output name, which does not have precision finer than a second, however the playlist is written and segments named by FFmpeg, and can be configured using custom muxer flags.
Here is an example set of Custom Muxer Settings for this purpose:
hls_list_size=0
~hls_start_number_source=epoch_us hls_segment_filename='E:\StreamArchive\%016d.ts'
~
hls_list_size=0
will produce a playlist file with all segments, rather than the default most recent 5. While wubloader is already suited to deal with playlists containing only some recent number of segments, it is useful for creating archival copies later to have a single source to mux everything from.hls_start_number_source=epoch_us
will set the starting number for the first segment in the playlist to be the Unix epoch in microseconds, which gets us our necessary timestamp. Subsequent segments are just incremented by 1.~ (SEE EDIT)hls_segment_filename='SOME_ABSOLUTE_PATH/%d.ts'
gives control over the exact naming of segments and allows it to be different from the playlist itself, which ordinarily the start number is just appended to.~ (SEE EDIT)Additionally, it is worth noting that the automatic split between ts files is done on keyframes, so the duration of segments is determined by the keyframe interval in OBS.
EDIT: Adding hls_flags=+program_date_time
to the Custom Muxer Settings is sufficient to get the #EXT-X-PROGRAM-DATE-TIME
tags that wubloader is looking for without renaming segment files.
OBS can record files to disk in a HLS-ready format. This consists of:
The m3u8 playlist contains duration metadata but not time metadata. OBS needs to be configured to include timestamps in the segment names, where we can parse it out.
We also should use links (hard or symbolic) to avoid double-storing the data while still being able to save it in the segment store under the normal scheme.