shaka-project / shaka-streamer

A simple config-file based approach to preparing streaming media, based on FFmpeg and Shaka Packager.
https://shaka-project.github.io/shaka-streamer/
Apache License 2.0
198 stars 62 forks source link

Keep timestamps from original stream #132

Open misiek08 opened 1 year ago

misiek08 commented 1 year ago

Hello! I try to work on live streams and provide HA setup. Input is HLS/RTMP (currently HLS, because it's much easier for me).

Input config:

inputs:
  - name: https://host/hawe/test/playlist.m3u8
    media_type: video
    extra_input_args: -copyts

  - name: https://host/hawe/test/playlist.m3u8
    media_type: audio
    extra_input_args: -copyts

Pipeline config: pipeline_live_config.yaml

I've tried to add -copyts in multiple places in transcoder_node.py, it gets passed to ffmpeg, but does not work. I suspect timestamps get reset because of any of the other flags.

My goal is to run streamer on two different hosts with $Time$ in segment_template and be able to automatically failover between them. I already found, tried and have working synchronized keyframe cutting points, so that's no problem.

misiek08 commented 1 year ago

I tried to directly run packager (without my keyframe synchronizing code applied) and ffmpeg, but resulting streams result in decode error while playing :( With shaka-streamer everything works good, so for now I'm trying to go easier way.

misiek08 commented 1 year ago

Changing container to mpegts probably fixed one part of the issue (but caused new ones). Is it known problem with ffmpeg that it is ignoring copyts while outputting mp4 fragments?