[FFmpeg-user] Cannot seek an HLS stream with epoch timecode
George Daramouskas
george.daramouskas at gmail.com
Wed Oct 30 03:36:40 EET 2024
Hi everyone,
I have an srt stream running 24/7, at some point in time I'd like to start
an HLS stream that has as its input the srt stream.
Now, the HLS stream could go down for arbitrary reasons and I am fine with
that, it should be able to be restarted and keep going, however because I
will be logging some events that take place at a point in time, I need to
be able to refer to that point in time regardless of when the HLS stream
started. This has led me to using unix epoch as a starting offset,
specifically:
`
ffmpeg -re -i srt://$url/?latency=20&mode=caller
<http://10.21.6.126:9001/?latency=20&mode=caller> -map 0:v -map 0:a
-hls_list_size 0 -master_pl_name stream1.m3u8 -strftime 1
-hls_segment_filename /core/data/stream1/%Y%m%d/segment-%s.ts
-strftime_mkdir 1 -output_ts_offset $(date +%s) -hls_flags
program_date_time /core/data/stream1.m3u8
`
Using ffprobe, I am able to verify that pts time is correct and gets
incremented correctly:
`
ffprobe -show_packets $url
........
[PACKET]
codec_type=audio
stream_index=1
pts=83020451563104
pts_time=1729592740.898000
dts=83020451563104
dts_time=1729592740.898000
duration=N/A
duration_time=N/A
size=344
pos=9420493
flags=K_
[/PACKET]
.....
`
pts_time and dts_time look correct, same for the rest of the a/v streams.
Now I want to seek on that hls and cut chunks out of it:
`
./ffmpeg_g -y -ss 1729592740.898000 -t 2 -seek_timestamp 1 -i
https://10.21.6.110/stream1.m3u8 /tmp/test123.mp4
`
I am getting `could not seek to position 1729592740.898` and I end up with
an improper mp4 cut from live instead from the right timestamp.
Am I misusing the cli somehow here?
Looking forward to hearing your thoughts
Kind regards,
George Daramouskas
More information about the ffmpeg-user
mailing list