video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.66k stars 2.56k forks source link

Only play the first five seconds even if audio is longer #6422

Open Impre-visible opened 4 months ago

Impre-visible commented 4 months ago

What do you want to do with Hls.js?

I want to only play the first 5s for each audio segments in the HLS, cause ffmpeg is making longer audio segments, so it's making the audio out of sync, if the audio is 5.02s it's playing 5.02s instead of 5s, the audio segments are never lower than 5s.

What have you tried so far?

Nothing, cause I didn't found anything on internet about that.

robwalch commented 4 months ago

You need to fix the encoding/segmenting issue. HLS.js does not edit segment length.

Note that if the timestamps at the start of each segment are correct, any overlapping samples may be either dropped or appended over. (However, with audio-only, hls.js may ignore unmarked discontinuities and overlapping sample timestamps, assuming segments are meant to be buffered in sequence).

Impre-visible commented 4 months ago

Sadly I didn't managed to, it's been some weeks know, and even the ffmpeg community can't find a way, I tried other things, everytime it's the same issue

robwalch commented 4 months ago

Sadly I didn't managed to, it's been some weeks know, and even the ffmpeg community can't find a way, I tried other things, everytime it's the same issue

Have you filed an issue?

Providing a sample source and HLS asset is essential. Maintainers and contributors need to analyze and compare your source material to the encoder/segmenter output.

Impre-visible commented 3 months ago

I have filled an issue, they sadly can't help, cause it's an issue with AAC and ADTS, you can't have a precise file duration, but if the audio is not forced to be adts, I can't play it, I tried flac, ogg, wav, with various codecs, nothing works until I force it to be adts... I opened a discussion to talk about other audio codecs #6435 . Maybe it will be implemented