[FFmpeg-user] Audio drift on HLS stream

George Daramouskas gdaramouskas at cuttingedge.com.au
Sun Jun 22 07:02:21 EEST 2025


Here is how I invoke ffmpeg:

`ffmpeg -use_wallclock_as_timestamps 1 -i srt://
0.0.0.0:9002?mode=listener&passphrase=$pwd&latency=120&pbkeylen=32 -map 0:v
-map 0:a -hls_list_size 0 -master_pl_name stream2.m3u8  -strftime 1
-hls_segment_filename /core/data/stream2/%Y%m%d/segment-%s.m4s
-strftime_mkdir 1 -hls_segment_type fmp4 -hls_flags append_list
-hls_playlist_type event -dts_delta_threshold 1 -c copy -copyts -bsf:a
aac_adtstoasc -map_channel 0.1.0? /core/data/stream2.m3u8`

I need use_wallclock_as_timestamps because I am having some long running
streams (weeks) and I need to know when there exist discontinuities. Also,
I would expect that the `-copyts` would not be necessary but apparently it
is as if I do not use it the timestamps start from zero.

My issue:

after a day or so I get audio drifting from the video when I view the m3u8
from multiple hls players, ffplay seems to working fine. It happens when
both I setup ffmpeg as a caller and listener. It happens with both mpegts
and fmp4 and it happens when I remove -c copy and enc/dec. I have used
multiple releases on ffmpeg from 4.4 onwards till 7.1. Playing the fmp4
directly the audio drift is not happening, it only happens when you play
through m3u8 and with multiple players (quicktime, shaka, hls.js)

I would appreciate any pointers as to what might be causing this.

Thank you

--
George Daramouskas | Software Development
*CUTTING*EDGE /
90 Victoria St, West End, QLD, 4101
*E* gdaramouskas at cuttingedge.com.au | *W* www.cuttingedge.com.au

--

-- 


This email is confidential and solely for the use of the intended 
recipient.  If you have received this email in error please notify the 
author and delete it immediately. This email is not to be distributed 
without the author's written consent. Unauthorised forwarding, printing, 
copying or use is strictly prohibited and may be a breach of copyright. Any 
views expressed in this email are those of the individual sender unless 
specifically stated to be the views of **Cutting Edge** Post Pty Ltd 
(**Cutting Edge**). Although this email has been sent in the belief that it 
is virus-free, it is the responsibility of the recipient to ensure that it 
is virus free. No responsibility is accepted by **Cutting Edge** for any 
loss or damage arising in any way from receipt or use of this email.  This 
email may contain legally privileged information and privilege is not 
waived if you have received this email in error.




More information about the ffmpeg-user mailing list