Skip to content

(discussion) I nailed why gapless playback is broken with transcoding#1611

Draft
HeroBrine1st wants to merge 2 commits intoUnicornsOnLSD:redesignfrom
HeroBrine1st:fix/transcoding
Draft

(discussion) I nailed why gapless playback is broken with transcoding#1611
HeroBrine1st wants to merge 2 commits intoUnicornsOnLSD:redesignfrom
HeroBrine1st:fix/transcoding

Conversation

@HeroBrine1st
Copy link
Copy Markdown

@HeroBrine1st HeroBrine1st commented May 1, 2026

Changes

  • Add "isFragmented" field in transcoding profiles and add a transcoding profile which uses /Audio/{id}/Universal API like downloads service which is the one that doesn't have gapped playback issue.
    Other profiles still use Audio/{id}/main.m3u8 API which is different to downloads service and that's, I think, is the cause of difference.
  • Break seeking with new profile

It still has some gap but it is the same as in offline mode - most likely a mismatch of signal between tracks which is pretty normal and means transcoding should go through whole playback, not individual tracks, but this requires server change.

Also, the "gapped playback" in my case is outright skipping some frames and even MPV itself (standalone, on desktop) is confused with those .m3u8 files (opus+mp4) sooo I think the issue is related to that. If I transcode them to flac with ffmpeg, everything's okay and the "some gap" is present in concatenation, too.

Todo before merging

  • Make all transcoding profiles non-fragmented
  • Fix seeking :-)

Related Issues

Fixes #861

Discussion

I'll of course try to fix seeking right now - I guess there's some code that uses the fact transcoding is enabled to seek inside fragments and now there's only one there's none, idk why it broke - but is this fix even appropriate given it drastically changes behaviour and, I guess, will do some breaks on iOS?

I'll also try to upload some audio files from github web

@HeroBrine1st
Copy link
Copy Markdown
Author

HeroBrine1st commented May 1, 2026

output.mp3 - with opus+ogg profile (new). It sounds like "kzzkt-bam-bam-bam-bam" and it is the same as if I use opus transcoding with offline mode
output2.mp3 - with opus+mp4 profile, and this sounds like "kzzkt-bam-bam" - which seems like a skipped frame, and it is also seen if I put the same m3u8 file (from transcodes-cache folder) into regular mpv on PC

kzzkt in both cases is an artifact of mismatch between different transcodes of consecutive tracks and that's a gap between 2 quants in different files (yes that's less than 0.02ms) which is very obvious due to speaker moving rapidly1 and doing a good air distortion which resonates with something idk. And this has a very good use in finding when tracks change. Of course original files don't have that gap but I did some manual changes to remove it, so this kzzkt could be problem on my end.

This might be placebo :P the difference is very subtle, also it's recorded on android debug build

Footnotes

  1. Actually it could be due to the fact all speakers have some sort of RC filters which don't pass frequencies higher than e.g. 20 kHz (which is the case for e.g. meander but also for this kzzkt) so it's resonating in the circuit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant