Seeking not working properly while transcoding

Issue description:

Seeking while transcoding is enabled only works every second time. The other times the audio will just restart from previous position I seeked to.

An example in the latest log file is me pressing +30s button ~5 times, with around a second delay every time, to confirm what audio played. Expected audio would be from around times of 0:00, 0:31, 1:02, 1:33, 2:04, 2:35,… but in reality what plays is 0:00, 0:00, 1:02, 1:02, 2:04, 2:04…

When I’m watching Jellyfin logs, I can see that on the failed seeks I don’t get a ffmpeg call on the failed seeks, but on the 1:02, 2:04… I get two ffmpeg calls resulting in two transcoded files being created.

Note that this behavior sometimes differs slightly, but I haven’t found a reproducible case. The slight difference is only in Jellyfin actually doing the call to ffmpeg for transcoding on the failed seeks BUT despite that, audio still behaves in exactly the same broken way. I had the best chance of triggering this alternate behavior when I was doing bigger seeks via seek bar and leaving the audio playing for longer. In these cases there won’t be the double call to ffmpeg on the good seeks. (seems like that is an artefact of the previous one not happening)

P.S: I found the other issue from ~20 days ago, about the seek bar being reset to 0:00, and therefore this is on v10.0.0 Beta 1 build, to mitigate that.

Logs:

Upload description: Roukanken

Additional information:

 

 

Reproduction steps:

 

  1. Ensure a transcoded file is playing
  2. Try to seek several times in a row
  3. Listen that the audio is not being played from correct times
     

Media provider:

Jellyfin

Screenshots:

     

You need to check Jellyfin logs to see why they do not work correctly.

AS you can see in the logs:

Prepared from provider PlayableMediaItem(source=MediaItem{externalId='4579943c582f1ae1b8b9ff84d6cb780a', mediaType=Song, file='/data/music/Shibayan Records/ココロバイブレーション [2010]/06 Shibayan Records - 月齢11.3のキャンドルマジック.flac', title='月齢11.3のキャンドルマジック', resume=0}, url=https://xxxxxx:443/audio/4579943c-582f-1ae1-b8b9-ff84d6cb780a/stream.ogg?DeviceId=76988F06A1EB3FC0AA523D5FDC8A8778&MediaSourceId=4579943c582f1ae1b8b9ff84d6cb780a&AudioBitrate=192000&AudioSampleRate=48000&PlaySessionId=13c84f73d6d94d5fa14425f9dcb5680e&api_key=REDACTED&TranscodingMaxAudioChannels=6&RequireAvc=false&Tag=a1af5e0e345b3650e3a7df0bc900c0c7&TranscodeReasons=ContainerBitrateExceedsLimit, externalThumbnail=, originalUrl=, urlIncludeResumePoint=true, urlIncludeResumePointValue=0, alreadyResolved=true, mimeTypeOverride=, payload={"LiveStreamId":"","PlaySessionId":"13c84f73d6d94d5fa14425f9dcb5680e","ItemId":"4579943c582f1ae1b8b9ff84d6cb780a"}, cacheKey=, preparationError=false, preparationErrorMessage=, playlistPosition=0, repeatCount=0, headers=null, mediaFormat=null, lyrics=null, chapters=null, uuid=65415712-b2de-45d7-ad7a-632d3d252545, supportSeeking=true, playsAsAdvertisement=false)
Prepared from provider PlayableMediaItem(source=MediaItem{externalId='4579943c582f1ae1b8b9ff84d6cb780a', mediaType=Song, file='/data/music/Shibayan Records/ココロバイブレーション [2010]/06 Shibayan Records - 月齢11.3のキャンドルマジック.flac', title='月齢11.3のキャンドルマジック', resume=31}, url=https://xxxxxx:443/audio/4579943c-582f-1ae1-b8b9-ff84d6cb780a/stream.ogg?DeviceId=76988F06A1EB3FC0AA523D5FDC8A8778&MediaSourceId=4579943c582f1ae1b8b9ff84d6cb780a&AudioBitrate=192000&AudioSampleRate=48000&StartTimeTicks=310000000&PlaySessionId=13c84f73d6d94d5fa14425f9dcb5680e&api_key=REDACTED&TranscodingMaxAudioChannels=6&RequireAvc=false&Tag=a1af5e0e345b3650e3a7df0bc900c0c7&TranscodeReasons=ContainerBitrateExceedsLimit, externalThumbnail=, originalUrl=, urlIncludeResumePoint=true, urlIncludeResumePointValue=31, alreadyResolved=true, mimeTypeOverride=, payload={"LiveStreamId":"","PlaySessionId":"13c84f73d6d94d5fa14425f9dcb5680e","ItemId":"4579943c582f1ae1b8b9ff84d6cb780a"}, cacheKey=, preparationError=false, preparationErrorMessage=, playlistPosition=0, repeatCount=0, headers=null, mediaFormat=null, lyrics=null, chapters=null, uuid=65415712-b2de-45d7-ad7a-632d3d252545, supportSeeking=true, playsAsAdvertisement=false)
Prepared from provider PlayableMediaItem(source=MediaItem{externalId='4579943c582f1ae1b8b9ff84d6cb780a', mediaType=Song, file='/data/music/Shibayan Records/ココロバイブレーション [2010]/06 Shibayan Records - 月齢11.3のキャンドルマジック.flac', title='月齢11.3のキャンドルマジック', resume=62}, url=https://xxxxxx:443/audio/4579943c-582f-1ae1-b8b9-ff84d6cb780a/stream.ogg?DeviceId=76988F06A1EB3FC0AA523D5FDC8A8778&MediaSourceId=4579943c582f1ae1b8b9ff84d6cb780a&AudioBitrate=192000&AudioSampleRate=48000&StartTimeTicks=620000000&PlaySessionId=13c84f73d6d94d5fa14425f9dcb5680e&api_key=REDACTED&TranscodingMaxAudioChannels=6&RequireAvc=false&Tag=a1af5e0e345b3650e3a7df0bc900c0c7&TranscodeReasons=ContainerBitrateExceedsLimit, externalThumbnail=, originalUrl=, urlIncludeResumePoint=true, urlIncludeResumePointValue=62, alreadyResolved=true, mimeTypeOverride=, payload={"LiveStreamId":"","PlaySessionId":"13c84f73d6d94d5fa14425f9dcb5680e","ItemId":"4579943c582f1ae1b8b9ff84d6cb780a"}, cacheKey=, preparationError=false, preparationErrorMessage=, playlistPosition=0, repeatCount=0, headers=null, mediaFormat=null, lyrics=null, chapters=null, uuid=65415712-b2de-45d7-ad7a-632d3d252545, supportSeeking=true, playsAsAdvertisement=false)
Prepared from provider PlayableMediaItem(source=MediaItem{externalId='4579943c582f1ae1b8b9ff84d6cb780a', mediaType=Song, file='/data/music/Shibayan Records/ココロバイブレーション [2010]/06 Shibayan Records - 月齢11.3のキャンドルマジック.flac', title='月齢11.3のキャンドルマジック', resume=93}, url=https://xxxxxx:443/audio/4579943c-582f-1ae1-b8b9-ff84d6cb780a/stream.ogg?DeviceId=76988F06A1EB3FC0AA523D5FDC8A8778&MediaSourceId=4579943c582f1ae1b8b9ff84d6cb780a&AudioBitrate=192000&AudioSampleRate=48000&StartTimeTicks=930000000&PlaySessionId=13c84f73d6d94d5fa14425f9dcb5680e&api_key=REDACTED&TranscodingMaxAudioChannels=6&RequireAvc=false&Tag=a1af5e0e345b3650e3a7df0bc900c0c7&TranscodeReasons=ContainerBitrateExceedsLimit, externalThumbnail=, originalUrl=, urlIncludeResumePoint=true, urlIncludeResumePointValue=93, alreadyResolved=true, mimeTypeOverride=, payload={"LiveStreamId":"","PlaySessionId":"13c84f73d6d94d5fa14425f9dcb5680e","ItemId":"4579943c582f1ae1b8b9ff84d6cb780a"}, cacheKey=, preparationError=false, preparationErrorMessage=, playlistPosition=0, repeatCount=0, headers=null, mediaFormat=null, lyrics=null, chapters=null, uuid=65415712-b2de-45d7-ad7a-632d3d252545, supportSeeking=true, playsAsAdvertisement=false)
Prepared from provider PlayableMediaItem(source=MediaItem{externalId='4579943c582f1ae1b8b9ff84d6cb780a', mediaType=Song, file='/data/music/Shibayan Records/ココロバイブレーション [2010]/06 Shibayan Records - 月齢11.3のキャンドルマジック.flac', title='月齢11.3のキャンドルマジック', resume=124}, url=https://xxxxxx:443/audio/4579943c-582f-1ae1-b8b9-ff84d6cb780a/stream.ogg?DeviceId=76988F06A1EB3FC0AA523D5FDC8A8778&MediaSourceId=4579943c582f1ae1b8b9ff84d6cb780a&AudioBitrate=192000&AudioSampleRate=48000&StartTimeTicks=1240000000&PlaySessionId=13c84f73d6d94d5fa14425f9dcb5680e&api_key=REDACTED&TranscodingMaxAudioChannels=6&RequireAvc=false&Tag=a1af5e0e345b3650e3a7df0bc900c0c7&TranscodeReasons=ContainerBitrateExceedsLimit, externalThumbnail=, originalUrl=, urlIncludeResumePoint=true, urlIncludeResumePointValue=124, alreadyResolved=true, mimeTypeOverride=, payload={"LiveStreamId":"","PlaySessionId":"13c84f73d6d94d5fa14425f9dcb5680e","ItemId":"4579943c582f1ae1b8b9ff84d6cb780a"}, cacheKey=, preparationError=false, preparationErrorMessage=, playlistPosition=0, repeatCount=0, headers=null, mediaFormat=null, lyrics=null, chapters=null, uuid=65415712-b2de-45d7-ad7a-632d3d252545, supportSeeking=true, playsAsAdvertisement=false)
Prepared from provider PlayableMediaItem(source=MediaItem{externalId='4579943c582f1ae1b8b9ff84d6cb780a', mediaType=Song, file='/data/music/Shibayan Records/ココロバイブレーション [2010]/06 Shibayan Records - 月齢11.3のキャンドルマジック.flac', title='月齢11.3のキャンドルマジック', resume=155}, url=https://xxxxxx:443/audio/4579943c-582f-1ae1-b8b9-ff84d6cb780a/stream.ogg?DeviceId=76988F06A1EB3FC0AA523D5FDC8A8778&MediaSourceId=4579943c582f1ae1b8b9ff84d6cb780a&AudioBitrate=192000&AudioSampleRate=48000&StartTimeTicks=1550000000&PlaySessionId=13c84f73d6d94d5fa14425f9dcb5680e&api_key=REDACTED&TranscodingMaxAudioChannels=6&RequireAvc=false&Tag=a1af5e0e345b3650e3a7df0bc900c0c7&TranscodeReasons=ContainerBitrateExceedsLimit, externalThumbnail=, originalUrl=, urlIncludeResumePoint=true, urlIncludeResumePointValue=155, alreadyResolved=true, mimeTypeOverride=, payload={"LiveStreamId":"","PlaySessionId":"13c84f73d6d94d5fa14425f9dcb5680e","ItemId":"4579943c582f1ae1b8b9ff84d6cb780a"}, cacheKey=, preparationError=false, preparationErrorMessage=, playlistPosition=0, repeatCount=0, headers=null, mediaFormat=null, lyrics=null, chapters=null, uuid=65415712-b2de-45d7-ad7a-632d3d252545, supportSeeking=true, playsAsAdvertisement=false)
Prepared from provider PlayableMediaItem(source=MediaItem{externalId='4579943c582f1ae1b8b9ff84d6cb780a', mediaType=Song, file='/data/music/Shibayan Records/ココロバイブレーション [2010]/06 Shibayan Records - 月齢11.3のキャンドルマジック.flac', title='月齢11.3のキャンドルマジック', resume=186}, url=https://xxxxxx:443/audio/4579943c-582f-1ae1-b8b9-ff84d6cb780a/stream.ogg?DeviceId=76988F06A1EB3FC0AA523D5FDC8A8778&MediaSourceId=4579943c582f1ae1b8b9ff84d6cb780a&AudioBitrate=192000&AudioSampleRate=48000&StartTimeTicks=1860000000&PlaySessionId=13c84f73d6d94d5fa14425f9dcb5680e&api_key=REDACTED&TranscodingMaxAudioChannels=6&RequireAvc=false&Tag=a1af5e0e345b3650e3a7df0bc900c0c7&TranscodeReasons=ContainerBitrateExceedsLimit, externalThumbnail=, originalUrl=, urlIncludeResumePoint=true, urlIncludeResumePointValue=186, alreadyResolved=true, mimeTypeOverride=, payload={"LiveStreamId":"","PlaySessionId":"13c84f73d6d94d5fa14425f9dcb5680e","ItemId":"4579943c582f1ae1b8b9ff84d6cb780a"}, cacheKey=, preparationError=false, preparationErrorMessage=, playlistPosition=0, repeatCount=0, headers=null, mediaFormat=null, lyrics=null, chapters=null, uuid=65415712-b2de-45d7-ad7a-632d3d252545, supportSeeking=true, playsAsAdvertisement=false)

The proper StartTimeTicks are used I have no other control over what Jellyfin do after and the actual data it sends.

You might want to test a Jellyfin 10.9 beta to see if it works better for you.

Honestly, Jellyfin logs don’t seem to have anything suspicious in them at all. Here, I did:

  1. tapped “previous song” twice. Since it was the only playing I got at start of it. (Seems like a good way to trigger that alternative behaviour)
  2. let it play for 30s
  3. seek +30s
  4. let it play for 30s
  5. seek +30s
  6. stop after a few more secs

Jellyfin logs for both those seeks look same (attached). Matching logs from app are uploaded too (_230035).

I also grabbed the files mentioned in the ffmpeg command in jellyfin while they were still streaming, and confirmed their contents are as expected (all three start at different points)

Seems like the issue has to be somewhere on the way back, either Jelly is doing fishy things with response, or Sym is not handing response properly…

jellyfin_log.txt (55.5 KB)

You do not use Playback cache so the data that is played comes from Jellyfin there’s nothing to handle differently at the playing stage, Symfonium can’t invent the audio.

I’m guessing there’s cache issue or session reuse on their side will see if i can repro and add one more workaround.

Ok so yes seems there’s some kind of race / cache, will force different sessions to workaround hoping there’s no other side effects.

Thank you for looking at it.

I also had time to briefly try latest Jelly nightly (2024040113), and it behaves exactly same. So if it’s fault of Jellyfin as it seems, it would be great if you opened a ticket. (as you likely have more info than me)

Seems like the fix is working properly, but I found one edge case where it probably wasn’t applied, as it still exhibits the same behavior - when the seeking is caused by the “previous track” button. Eg steps to reproduce:

  1. Play single transcoded track
  2. Seek to arbitrary position X
  3. Press “Previous track”
  4. Seek bar jumps properly to 0:00 as expected, but audio starts playing from X

Otherwise both seek bar & seek buttons work properly, thanks for the fix :+1:

Hum yes the hack is not applied for start position, will fix that one too.

1 Like