javascript - Chrome Gapless WebM + FFMPEG -
i'm trying gapless playback of segments generated using ffmpeg:
i use ffmpeg encode 3 files source 240000 samples @ 48khz, i.e. 5 seconds.
ffmpeg -i tone.wav -af atrim=start_sample=24000*0:end_sample=240000*1 -c:a opus 0.webm ffmpeg -i tone.wav -af atrim=start_sample=24000*1:end_sample=240000*2 -c:a opus 1.webm ffmpeg -i tone.wav -af atrim=start_sample=24000*2:end_sample=240000*3 -c:a opus 2.webm
when looking @ meta data (using ffprobe
, ffmpeg -loglevel debug
) file following seems me inconsistent values:
duration: 5.01, start 0.007 discard 648/900 samples 240312 samples decoded
if have several of these files how play them seamlessly without gaps? i.e. in browser i've tried:
sourcebuffer.timestampoffset = 5 * n - 648/48000; sourcebuffer.appendwindowstart = 5 * n; sourcebuffer.appendwindowend = 5 * (n+1); sourcebuffer.appendbuffer(new uint8array(buffer[n]));
however, there audible gaps.
how many samples supposed discard? 0.007 * 48000, 648, or 240312 - 240000?
here html page can opened in chrome test.
you need simple http server run it:
<< ls >> index.html 0.webm 1.webm 2.webm << npm install -g http-server << http-server --cors
Comments
Post a Comment