Seeking FLAC Transcodes

Issue description:

Using latest Development branch of Navidrome.

I apologize as I’m not sure if this is a Symfonium issue or a Navidrome issue. I am unable to seek when streaming FLAC files from my server. Files are typically 24/96 FLAC and transfer to 16/44 for streaming.

If i switch the Transcoded format to mp3, I can seek but not with FLAC. Testing in the Navidrome Web app, seeking seems to be functioning with the same transcoding settings.

Logs:

Upload description: jeffgt14

Additional information:

Navidrome logs:
time=“2024-01-04T17:49:57Z” level=debug msg=“API: New request /rest/search3.view” client=Symfonium requestId=ca6bd13c51a4/h8lBz4oQmp-003186 username=admin version=1.13.0
time=“2024-01-04T17:49:57Z” level=debug msg=“Found matching player” client=Symfonium id=aa5fbd9e-e638-483a-b869-a3151defad70 requestId=ca6bd13c51a4/h8lBz4oQmp-003186 type=Symfonium/Android username=admin
time=“2024-01-04T17:49:57Z” level=debug msg=“Search resulted in 1000 songs, 0 albums and 0 artists” elapsedTime=118.1ms query=“""” requestId=ca6bd13c51a4/h8lBz4oQmp-003186 username=admin
time=“2024-01-04T17:49:57Z” level=debug msg=“API: Successful response” endpoint=/rest/search3.view requestId=ca6bd13c51a4/h8lBz4oQmp-003186 status=OK username=admin
time=“2024-01-04T17:49:57Z” level=debug msg=“HTTP: GET redacted/rest/search3.view?query=%22%22&songOffset=34000&songCount=1000&albumOffset=0&albumCount=0&artistOffset=0&artistCount=0&u=admin&t=[REDACTED]&s=[REDACTED]&v=1.13.0&c=Symfonium&f=json” elapsedTime=147.7ms httpStatus=200 remoteAddr=“174.212.105.63:3245” requestId=ca6bd13c51a4/h8lBz4oQmp-003186 responseSize=793363 userAgent=“Symfonium/7.1.0a (Linux;Android 14)”

Trace log of ffmpeg command sent:
time=“2024-01-04T18:03:04Z” level=trace msg=“Executing ffmpeg command” cmd=“[/usr/local/bin/ffmpeg -i /music/Accept/2014 - Blind Rage (EU Black Vinyl) [OB69004]/09 - From the Ashes We Rise.flac -ss 0 -map 0:a:0 -af dynaudnorm -resampler soxr -precision 28 -dither_method triangular -sample_fmt s16 -ar 44100 -c:a flac -f flac -]” requestId=c9074331c61d/rY4hZYbB5i-000100 username=admin
ffmpeg version 6.1 Copyright (c) 2000-2023 the FFmpeg developers

Reproduction steps:

 Not provided 

Media provider:

Subsonic

Screenshots:

     

You force transcoding at server side, Symfonium can’t detect that and FLAC is not a seekable format until it’s fully transcoded.

OpenSubsonic adds support for seeking during transcoding but the transcoding needs to be initiated from Symfonium so Symfonium is aware and use the extension.

There’s a lot of work needed to improve Subsonic transcoding but currently there’s not much possible to do to support your specific transcoding setup.

So it’s specifically the file format that makes it unseekable during transcoding? It seems to work fine in the Navidrome Web app.

Even if I cache the FLAC for offline use, I still can’t seem to seek.

It’s a mix of the format and the fact that Symfonium don’t control it so can’t use the new API to seek.
Navidrome have it’s own special API that allows seeking via restart during transcoding.

Fully cached media should work if they are properly transcoded.

You can offline cache the media then while offline select save to downloads and upload the transcoded file so I can see the file.

Yeah something may be off in the transcode. File is showing a duration of 0 seconds.

Hopefully this upload works.

You should upload to https://upload.symfonium.app :slight_smile:

Oops sorry… This is done now.

jeffgt14-testflac

Ok so yes the file have issues, even VLC can’t figure out the duration, meaning some mode of precise seek can’t work :frowning:

Maybe try with older version of ffmpeg in case it’s a 6.1 bug ?

If you only transcode to Symfonium you can test ALAC that is better suited for streaming too.

m4a doesn’t seem to work with pipes. Keeps giving me errors that it doesn’t support non-seekable formats.

I do think this is more of an issue with how ffmpeg and FLAC work with pipes so you can probably close this and I’ll dig in more to see if I can get something to work. I always used SoX with Airsonic to stream FLAC but was trying to get a singular transcode command here that would also convert my Wavpack DSD files so it’s a bit of a mess.

Still really odd Navidrome WebUI sudo works even though it’s clearly having issues with FLAC headers as well:

time=“2024-01-05T17:37:35Z” level=trace msg=“SQL: SELECT s.*, m.* FROM scrobble_buffer s LEFT JOIN media_file m on m.id = s.media_file_id WHERE (service = {:p0} AND user_id = {:p1}) ORDER BY play_time, s.rowid LIMIT 1” args=“map[p0:lastfm p1:384a823d-0cc5-4ae3-8492-d10c9e4dcf39]” elapsedTime=“284.77µs” rowsAffected=-1
[flac @ 0x7ff7330a25c0] unable to rewrite FLAC header. speed= 186x
[out#0/flac @ 0x556a83d488c0] video:0kB audio:30582kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.030317%
size= 30591kB time=00:04:38.85 bitrate= 898.7kbits/s speed= 188x
time=“2024-01-05T17:37:36Z” level=trace msg=“File successfully stored in cache”
cache=Transcoding key=“717e2d53b3f651feaba39a231516bb9d.2023-12-30T08:58:59.100940572Z.320.flac.0” requestId=c9074331c61d/rY4hZYbB5i-010197 username=admin

I explained you already that Navidrome have it’s own API to seek via restart.

The same API is now also possible in OpenSubsonic for Symfonium to use, but only if the transcoding is managed by Symfonium and not forced server side.

There’s plans to improve the whole OpenSubsonic transcoding API but no solution for now.

Migrated to a bash script on my server to change my transcode based on codec type so my FLAC transcodes now go through SoX and seeking works. Probably works differently than ffmpeg does for streaming but works great for me so I’ll stick with it.

I do see value in the Opensubsonic extension as it should resolve my issues with AAC files not seeking but those are very few in my library.