Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
flac - seeking within files doesn't function in many locales, and breaks playback #277
Many transcoding rules make use of flac's ability play out a subsection of a file, as if it were a single track. For example, LMS' handling of 'wav files with cue sheets' relies on this ability.
Sadly, this is currently broken in many locales, and playback will simply fail.
The flac command line that handles playback will include
This time offset specification is generated by
flac, on the other hand, interprets these options in a locale dependent manner. In a comma using locale, the version of flac that currently ships with LMS (1.3.2) will simply fail with this output:
The shipped flac was updated to version 1.3.2 during the summer of 2018.
The earlier version (1.2.1) would 'fail' in a more gracious manner, in that it would simply discard the fractional part of the time specification before continuing.
A change is required to restore functionality, and this might be undertaken either within LMS itself, or by suitably patching the shipped version of flac.
So, which way forward ? Any thoughts ?
Here are my, probably incomplete, thoughts:
The wvunpack utility that ships with LMS uses the same
Prefacing each relevant flac command line with, for example,
This appears to be straightforward, effective, and probably resilient against future changes to flac. A proof of concept patch has already been tested on macOS, Debian linux, and at least one version of Windows, and appears to work as expected.
Again, proof of concept patches have been prepared and appear to work as expected.
I've raised this issue on this slimserver repo in first instance. If patching flac is seen as the better option, then perhaps it should be moved to the slimserver-vendor repo.
There is a recent and long thread on the forum which has been instrumental in exposing the problem: Playing cue files with LMS. Thanks are due to all participants for their patient investigation and support !
Apologies for length of post.
Thanks for this summary! I tried to follow the linke discussion... but quickly was lost :-)
Are there more known "real-world" cases than the one discussed in that thread? I know that you're able to reproduce the issue. And I'm not trying to play down the problem. I just want to know about the risk of breaking something for users without the problem vs. solving it for a few.
I tend to vote for patching flac for a few reasons, but mostly for keeping the change as isolated as possible:
"real world " examples of where "skip" parameter is used - anytime flac is transcoded and/or resampled. If user seeks (i.e. ffwd or rew to a time spot) when
A number of comments from Anglophones expressed surprise that the problem had not been noticed before. Forum member bpa suggested:
I have a few (off-air) jazz sets, each recorded as one audio file, and I use cue sheets to break the set into individual track segments to give me a nice 'Album view' of the set. But, they are all mp2/mp3 format, and
Forum member JohnB presented an off air classical music recording organized in the same manner. This did break, because he provided a flac encoded file. But I get the impression that this was probably converted from an m4a/aac source, which would normally use
I don’t know of any more real world cases, but my experience is not very broad. Perhaps some non-Anglophones do, but have remained silent.
I suppose that anyone who habitually rips a CD into an ’entire’ wav/flac file would be impacted, but perhaps learns to split the rip up into tracks. I don’t have enough experience of the transcoding methodologies to narrow down specific use cases. Input from others might be helpful.
I think that patching flac can be entirely risk free if we limit ourselves to patching flac's time specification parser, on the try/retry on fail principle.
Forcing flac into the ‘C’ locale should also be risk free, provided there are no unintended consequences elsewhere within flac. Example: parsing of file names.
But I’d be guided by those who will be implementing and maintaining the patch. I’m a tinkerer, not a long serving, grey bearded, developer.
 I believe that you would not have remained silent !
I've cloned flac and published the proof of concept patches should anyone wish to review in context.
Operate flac exclusively in 'C' locale
Time specification parser - Simple try/retry between
Time specification parser - Try in 'C' locale first, retry 'normally' if fails