-
Notifications
You must be signed in to change notification settings - Fork 350
Description
Describe the bug
Seeking fails when playing Qobuz FLAC streams while transcoding to MP3. When a user attempts to seek during playback, the track stops playing, and the next track in the queue will start.
When the error occurs, the following output occurs from the Perl process itself (not server.log):
-: ERROR while decoding data
2026-01-04T19:40:32.819720687Z state = FLAC__STREAM_DECODER_END_OF_STREAM
2026-01-04T19:40:33.055088732Z -: WARNING, don't have accurate sample count available for WAVE header.
2026-01-04T19:40:33.055122674Z Generated WAVE file will have a data chunk size of 0. Try
2026-01-04T19:40:33.055125063Z decoding directly to a file instead.
2026-01-04T19:40:33.055301011Z Unsupported number of channels: 0
2026-01-04T19:40:33.055308028Z Can't init infile '-'
2026-01-04T19:40:33.055590838Z -: WARNING, cannot check MD5 signature since there was no STREAMINFO
Seeking works correctly with native FLAC playback (no transcoding).
This issue is related to #514. I was recently re-investigating, but I thought it would be better to create a more easily reproducible example.
To Reproduce
- Configure Qobuz with an account. Keep the default "Preferred Format" value of "FLAC 16 bits / 44.1 kHz".
- For a player, configure Audio/Bitrate Limiting to any value except "No Limit".
- Stream a FLAC track from Qobuz. The track should successfully start playing.
- Attempt to seek to a different position in the track. The track should stop playing.
Expected behavior
Seeking to the requested position in the track. If this is not possible, the track should prevent seeking.
Screenshots
N/A
System Information (please complete the following information):
- OS on which you're running LMS: Docker
- Hardware on which you're running LMS: x86_64
- Web skin used: Default and Material
- Browser: Firefox, but should be browser agnostic
- LMS Version: Git (
5185f1690 - (HEAD -> public/9.1) Changelog update (2025-12-30 05:40:33 +0100)) - Player(s) involved: Squeezelite
Additional context
The tracks that I'm testing are being set as _canSeek(1) here:
slimserver/Slim/Player/Song.pm
Lines 841 to 844 in d7c0433
| if ($handler->can('canSeek')) { | |
| if ($handler->canSeek( $self->master(), $self )) { | |
| return $self->_canSeek(2) if $handler->can('canTranscodeSeek') && $handler->canTranscodeSeek(); | |
| return $self->_canSeek(1) if $handler->isRemote() && !Slim::Music::Info::isVolatile($handler); |
Removing I from the flc mp3 * * line stops streams from being transcoded and allow local, non-streamed FLACs in my local library to be transcoded to MP3.
Line 138 in cb9b302
| # IFB:{BITRATE=--abr %B}T:{START=--skip=%t}U:{END=--until=%v}D:{RESAMPLE=--resample %D} |
I did see some of the work with convert.conf extensions and experimented with it:
Lines 44 to 46 in cb9b302
| # E - extensions syntax E:{<key>=<value>,<key>=<value>} | |
| # NOSTART=I/F/R : no $START$ field when transcoding from I/F/R | |
| # NOHEADER=I/F/R : strip out header when transcoding from I/F/R (waf/aif only) |
I am able to get both local FLACs (both standalone and part of an embedded cuesheets) and remote streamed FLACs to work with the following:
flc mp3 * *
# IFB:{BITRATE=--abr %B}T:{START=--skip=%t}U:{END=--until=%v}D:{RESAMPLE=--resample %D}E:{NOSTART=I}
[flac] -dcs $START$ $END$ --force-raw-format --sign=signed --endian=little -- $FILE$ | [sox] -q -t raw --encoding signed-integer -b $SAMPLESIZE$ -r $SAMPLERATE$ -c $CHANNELS$ -L - -t raw - | [lame] --silent -r -q $QUALITY$ $RESAMPLE$ $BITRATE$ -B 32 - -
I kept the double pipe for consistency. Note that I added -r to the lame encoding. Sox in the Docker image advertises mp3 support, but I'm guessing lame might do a better job converting over. The main issue I see with this implementation are warnings being echoed:
# On all track plays
2026-01-04T21:43:10.457212426Z WARNING: libsndfile may ignore -r and perform fseek's on the input.
2026-01-04T21:43:10.457239491Z Compile without libsndfile if this is a problem.
# Seeking on remote stream
-: WARNING, cannot check MD5 signature since there was no STREAMINFO
2026-01-04T21:48:06.662483541Z WARNING: libsndfile may ignore -r and perform fseek's on the input.
2026-01-04T21:48:06.662500172Z Compile without libsndfile if this is a problem.
I don't have a firm grasp what "should" be happening here and the "correct" way to fix it, which is why I've purposefully not made this as a PR request.
Thanks!