New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flac - seeking within files doesn't function in many locales, and breaks playback #277
Comments
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[1]. 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. Patching flac 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. [1] 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 |
Hi @mw9 - I'm a bit confused: are these three approaches at addressing the same issue? It would probably indeed be better to continue the discussion in https://github.com/Logitech/slimserver-vendor. Thanks a lot! |
@mherger - so that was a fail, then ! "Yes" to your question. I've been away for a few days, and will be for a few more. I shall continue the discussion as suggested, on my return. |
@mw did the discussion continue elsewhere? Would you know whether this behaviour could have been triggered by an update to the flac binary? Whether flac changed the parsing? |
Ok, skimmed the flac changelog and found this line for flac 1.3.0:
What they've fixed breaks things on our end. We'll have to implement locale aware time string rendering, too. Unfortunately we haven't updated all platforms to flac >= 1.3.0. Which means that we'll have to make this decision based on the flac version used... |
Another idea: what if you prefixed all lines in
I tried to understand what it would require to have the timestamp localized in LMS, and it looks like a lot of code. or code too specific to one file format in an otherwise totally format agnostic environment. The biggest issue here is that it's not just "flac requires localized timestamps", but it's only flac from a certain version. |
IIRC This is not a Linux only issue. As noted in post 1 LOCALE prefix won't works on Windows. |
We did update flac for some (but not all) platforms a while back. That new version would respect the locale, but not the old one. |
We did a lot of testing of the new flac with different LOCALE settings. I think we need to double check what version the user has installed and the LOCALE Settings to understand (i) did we miss something or (ii) is user somehow using a standard (i.e. not LMS) version of Flac. |
I thought that too, but can't find the outcome of the testing. Where did it happen? |
Most of the testing results are in the Playing cue files with LMS thread starting around page 19. https://forums.slimdevices.com/showthread.php?110871-Playing-cue-files-with-LMS/page19 |
Thanks @ralph-irving! I skimmed about 10+ pages, but didn't see a conclusion - other than that we should create a patch for flac. That's probably when I asked @mw9 to continue over in the slimserver-vendor repository... oh my brain... |
The flac test patch discussion continues on pages 34-35 as well. Did you get that far? It's very hard to follow in the thread. @bpa concluded that patch3 works if applied to the flac sources from slimserver-vendor git but not the latest flac sources available at testing time. https://forums.slimdevices.com/showthread.php?110871-Playing-cue-files-with-LMS&p=948702&viewfull=1#post948702 |
@mw9 - could you please provide a pull request for in slimserver-vendor with what is referred to as the "patch3"? Thanks! |
Apologies to all, I've been very distracted for the last couple of months, so didn't follow up on my promise to raise on slimserver-vendor. @mherger - will do. I agree that "patch3" seems to be the most platform agnostic/trouble free option, and readily maintainable. |
Re [1]: This should hit me, as we have a decimal comma in Germany, only I use very few CUE files (prefer single titles and gapless playback). In general, I’d opt for staying away from modifying |
Windows is the problem here, as it, or they, apparently don't accomodate prepending the command line with something like The proposed |
Got hit by this one while I was doing my header & transcoding rules patches. Any idea how to solve it? |
* always update the client's playlist reference on `playlist save` * remove playlist references from clients on `playlists delete`
@ralph-irving what was the change made to the source? Can you update the source or add the patch in slimserver-vendor? I would like to update the aarch64 binaries. |
Here is a link to the PR that I created: @ralph-irving highlighted an error that I had made, that I have since corrected. Hopefully the PR as it now exists aligns with the change that @ralph-irving actually took up, but only he can confirm that for certain. |
@paul-1 I used the flac-C-locale patch file and script changes from PR#72 mw9 linked above. |
The binaries that I supply with pCP are patched, I typically do not submit my binaries to this repo, as pCP is always a very recent glibc, and that causes general compatibility issues with other distros. For example pCP7 is using glibc2.31, whereas RaspiOS64 is using glibc2.28. |
@paul-1 Aplogies, I had assumed that you were the go-to source for aarch64. |
I have RaspiOS64 running on an rpi4. I can build a patched aarch64 flac binary. |
I've build flac, faad, sox and wvunpack for aarch64 using glibc 2.28. They can be download from https://sourceforge.net/projects/lmsclients/files/utility/aarch64/ However, I suspect we're going to have issues with glibc as it seems ever flavour of aarch64 is using a different version. So before I create a PR to lms8 we really need to have users test them. |
That would mostly be NAS users, right? Anybody in this thread here actually using an aarch64 based system? I'd prefer to defer including these in LMS8 today, as I plan to release 8.0.0 really soon. |
The 64bit piCorePlayer 7.0 upcoming release is aarch64, which I'm using. My glibc concern is based on getting a single working squeezelite binary for ubuntu and debian aarch64 (arm64) as well as raspos64. Using the older 2.28 glibc allows the binaries to run on systems with newer versions but not older. I would expect the newer binaries I built not to work on a NAS with a glibc version older than 2.28, but don't have one to confirm. |
Closing because updated flac binaries now prepared for all supported systems. |
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
--skip
and--until
time offset options, in this form:--skip=mm:ss.ss
.mm
represents the minutes part of the file offset,ss.ss
represents the seconds part, and can include a decimal fractional part.This time offset specification is generated by
Slim::Utils::DateTime::fracSecToMinSec
, which generates a'.'
as the decimal separator, without regard to the current locale in force.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:
ERROR: invalid value for --skip
.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:
Slim::Utils::DateTime::fracSecToMinSec
that is locale aware.The wvunpack utility that ships with LMS uses the same
--skip
and--until
options. However it is not locale aware, so a new, locale aware, conversion function would be required to avoid breaking wvunpack.convert.conf
Prefacing each relevant flac command line with, for example,
LC_NUMERIC=C
should be effective on all Unix-like systems, but it appears not to be supported on a Windows system. Unless someone knows differently.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.
'.'
, as separator regardless of locale.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 !
I'll mention @bpa-code, @paul-1, and @ralph-irving directly, as they have all contributed to and/or followed the forum thread, and may have a direct interest in the outcome.
Apologies for length of post.
The text was updated successfully, but these errors were encountered: