Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Junior Member
    Join Date
    Jan 2021
    Posts
    22

    Opus playback speed - too fast + high-pitched

    Symptoms: Opus playback on my LMS 8.3 (Windows) is too fast when I transcode to PCM for my Booms.

    When I transcode to FLAC, playback speed seems fine, but most songs stop before they reach the end. It seems they end by the same amount of time playback would ordinarily be too fast.

    Not just the speed is too fast, the pitch changes up, too. Like speeding up a good old analog record or cassette tape.

    Also, directly jumping to a place in the track while transcoding to PCM causes playback to fail with an "can't open... only audio files are supported".
    This works fine when I transcode to FLAC.

    Here is an example: https://1drv.ms/u/s!AoQI5_3ipPc6pY1K...2lwpg?e=ztRzkK

    Vorbis and MP3 files play and behave as expected.

    Any ideas?
    Last edited by damazta; 2022-06-28 at 11:03. Reason: Share added

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,733

    Opus playback speed - too fast +high-pitched

    Hi damazta

    are you domcote on Github? I'd prefer not to respond in three places if
    we can keep this in one place :-).

    > Symptoms: Opus playback on my LMS 8.3 (Windows) is too fast when I
    > transcode to PCM for my Booms.
    >
    > When I transcode to FLAC, playback speed seems fine, but most songs stop
    > before they reach the end. It seems they end by the same amount of time
    > playback would ordinarily be too fast.


    Would you have a shorter track exposing the issue? The sample file
    provided on Github is pretty long, and not exactly my preferred musical
    style :-D.

    I tested with a few shorter Opus files I have. They showed the same
    Mickey Mouse symptoms transcoding to PCM. But FLAC would play ok. BUT I
    did not test on Windows (yet). Would you have some other (not Windows)
    means to test playback? I'd like to confirm whether it's a Windows only
    issue or not.

    > Any ideas?


    Don't use Opus? :-) If I understood correctly it's not optimized for
    offline use with local files, but rather for live streaming.

  3. #3
    Junior Member
    Join Date
    Jan 2021
    Posts
    22
    Quote Originally Posted by mherger View Post
    Hi damazta

    are you domcote on Github? I'd prefer not to respond in three places if
    we can keep this in one place :-).

    > Symptoms: Opus playback on my LMS 8.3 (Windows) is too fast when I
    > transcode to PCM for my Booms.
    >
    > When I transcode to FLAC, playback speed seems fine, but most songs stop
    > before they reach the end. It seems they end by the same amount of time
    > playback would ordinarily be too fast.


    Would you have a shorter track exposing the issue? The sample file
    provided on Github is pretty long, and not exactly my preferred musical
    style :-D.

    I tested with a few shorter Opus files I have. They showed the same
    Mickey Mouse symptoms transcoding to PCM. But FLAC would play ok. BUT I
    did not test on Windows (yet). Would you have some other (not Windows)
    means to test playback? I'd like to confirm whether it's a Windows only
    issue or not.

    > Any ideas?


    Don't use Opus? :-) If I understood correctly it's not optimized for
    offline use with local files, but rather for live streaming.
    Hi, yes I am domcote on github. 😁 Sorry for double-posting. I just wasn't sure which forum is the best one to post a possible bug to.

    Where shall we continue?

    PS. meanwhile, I will indeed not use opus and revert back to vorbis, which is proven. Thing is, opus substantially better with transparency around 128kbit. Since we stream all over the globe and not just at home these days, bandwidth counts. Especially on mobile broadband. 😉

  4. #4
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,777
    Your test file is no longer available.

    What is wrong with playing back in Flac ?

    When you play back in PCM - the LMS convert rules indicate that sox is supposed to transcode and if necessary resample so for non 44.1Khz files - PCM will be "worse" than Flac.

    Enable logging with player.source set to INFO and from logs confirm what sox conversion command line is being used.

  5. #5
    Junior Member
    Join Date
    Jan 2021
    Posts
    22
    Quote Originally Posted by bpa View Post
    Your test file is no longer available.

    What is wrong with playing back in Flac ?

    When you play back in PCM - the LMS convert rules indicate that sox is supposed to transcode and if necessary resample so for non 44.1Khz files - PCM will be "worse" than Flac.

    Enable logging with player.source set to INFO and from logs confirm what sox conversion command line is being used.
    Yeah, sorry - I deleted them again, since LMS seems to have multiple issues with opus right now.

    Here is a new share with some very different music styles: https://1drv.ms/u/s!AoQI5_3ipPc6pY5j...yNZuw?e=ZY4SeW

    I'd prefer to transcode to FLAC to save Wifi bandwidth. The problem with transcoding to FLAC is this: https://github.com/Logitech/slimserver/issues/793
    Playback ends prematurely.

    Could there be a sample-rate mismatch? Opus is always 48kHz, whereas sox might be operating on a 44,1kHz assumption? Would that cause speed issues and premature playback stopping?

    Also attached the log with player.source on INFO. Seems clear something isn't right...
    server.log.zip

  6. #6
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,777
    I'll have a quick look. I know nothing about opus so I'm looking at it as an audio transcode problem

    Just loaded into LMS and on scanning and I get "console" errors (i.e. from a library routine probably Audi::Scan from somewhere not in LMS) from 2 of the 3 files.

    The problem files do not have any codec details. I have Audio::Scan 1.02 - I need to see if I can get Audio::Scan 1.05 (which is on Windows)

    Code:
    Not an Opus file (bad opus header): /mnt/hddrive/home/albums/Test/Heatwave Moving Through a Ghost Town.01.Louigi Verona.198. Heatwave Moving Through a Ghost Town.opus
    Not an Opus file (bad opus header): /mnt/hddrive/home/albums/Test/Until All The Ghosts Are Gone HD 24-96.01.ANEKDOTEN.Shooting Star.opus
    I looked at log and tested command line conversion (i.e.not within LMS) of the files using same parameters as in log. File conversion worked OK and had correct duration & samplerate. So I see no problem with sox on Ubuntu.
    Last edited by bpa; 2022-07-06 at 04:23.

  7. #7
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,777
    It looks like when playing PCM - LMS has scanned the file as 48Khz and told the player to play PCM at 48Khz.
    However sox command has resampled to 44.1kHz.

    If I remove the "-r 44100" form the convert.conf command - the file plays OK as LMS has told player it is a 48kHz stream.

    This looks like it could be a generic LMS error. Any format of non 44.1Khz files may be played incorrectly as PCM


    The other two files have a problem with opus header. LMS cannot scan them, If I try to play them "natively" in a SqueezeESP32 player - LMS and player crashes.
    LMS opus scanning needs not be checked/fix as files play OK with sox and ffplay.

  8. #8
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,777
    When testing I have to echo Michael's comment - it's hard work with these files.
    Would you have a shorter track exposing the issue? The sample file
    provided on Github is pretty long, and not exactly my preferred musical
    style :-D.
    At the moment only one of the three files can be tested as LMS does not scan the file properly so metadata is unreliable

    When you say a file is truncated in Flac - what amount is the truncation ?

    If it is about 15 secs or less, then I think it is a Windows issues (probably socketwrapper related) which has appeared with some m4a podcast.

  9. #9
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,777
    After trying to check headers. Some contradictions with these files.
    Sox & ffplay say they are 48Khz. The official opusinfo and opusdec from https://opus-codec.org/ say they are 44.1kHz.

    How were they created ?

  10. #10
    Senior Member
    Join Date
    May 2010
    Location
    London, UK
    Posts
    976
    Quote Originally Posted by damazta View Post
    Symptoms: Opus playback on my LMS 8.3 (Windows) is too fast when I transcode to PCM for my Booms.

    When I transcode to FLAC, playback speed seems fine, but most songs stop before they reach the end. It seems they end by the same amount of time playback would ordinarily be too fast.

    Not just the speed is too fast, the pitch changes up, too. Like speeding up a good old analog record or cassette tape.
    This is a consequence of what seems to be a rather peculiar transcoding conversion rule:
    Code:
    ops mp3 * *
    	# IFB:{BITRATE=--abr %B}D:{RESAMPLE=--resample %D}
    	[sox] -q -t opus $FILE$ -t wav - | [lame] --silent -q $QUALITY$ $RESAMPLE$ $BITRATE$ - -
    
    ops aif * *
    	[sox] -q -t opus $FILE$ -t raw -r 44100 -c 2 -2 -s $-x$ -
    
    ops pcm * *
    	[sox] -q -t opus $FILE$ -t raw -r 44100 -c 2 -2 -s -
    
    ops flc * *
    	# IFRD:{RESAMPLE=-r %d}T:{START=trim %s}
    	[sox] -t opus $FILE$ -t flac -C 0 $RESAMPLE$ - $START$
    Sox has been instructed to resample to 44100 Hz when producing pcm (and aif). But LMS is unaware of this "under the hood" resampling activity. So LMS believes that the sample rate of the stream sent to the player is 48000 Hz (which is what the source opus stream is), and advises the player accordingly. So the player receives a stream with a sample rate of 44100 Hz but believes it to be 48000 Hz, and plays it out accordingly. The consequences for speed and pitch follow.

    The conversion rule was added in this commit:
    https://github.com/Logitech/slimserv...ed4cb2b46e14f3

    I can see no hint as to why "resample to 44100 Hz" was specified. I suspect that it is simply a mistake, and should be removed.

    EDIT: Crossed with @bpa.


    Quote Originally Posted by damazta View Post
    Also, directly jumping to a place in the track while transcoding to PCM causes playback to fail with an "can't open... only audio files are supported".
    I believe this to be a consequence of the particular transcoding rule used which, unlike the flac rule, does not appear to support seeking to a given start time. I don't know why not.
    I tried a test with the following (flac rule inspired) rule:
    Code:
    ops pcm * *
            # IFT:{START=trim %s}
            [sox] -q -t opus $FILE$ -t raw -c 2 -2 -s  - $START$
    This seemed to work ok, with a quick test. My knowledge of transcoding rules is limited, though, so would require more experienced eyes than mine to verify that it is, indeed, correct.
    Last edited by mrw; 2022-07-06 at 07:16.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •