dbvideostriketeam / wubloader

MIT License
13 stars 6 forks source link

downloader: Work with local OBS HLS recordings #387

Open ekimekim opened 5 months ago

ekimekim commented 5 months ago

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.

VodBox commented 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'~

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.