Home of the Squeezebox™ & Transporter® network music players.
Page 7 of 7 FirstFirst ... 567
Results 61 to 68 of 68
  1. #61
    Junior Member
    Join Date
    Dec 2013
    Location
    London
    Posts
    22
    Quote Originally Posted by gorman View Post
    Hi! Did you survive the pub? Waiting for new debug lines :-)
    Easy, Buster. I've got a few other things on, too, you know. ;)

    Anyway, I've already discovered that not all remote streams are in fact remote. Plugins apparently are "streamMode: I" rather than "R", even though they present a URL as their $PATH$. I think. Anyway, I'm making progress, and hope to have something for you guys to test and laugh at within the next couple of days.

  2. #62
    Quote Originally Posted by gorman View Post
    I had to use ffmpeg because, as far as I can see, LAME does not accept time offsets when decoding (https://svn.code.sf.net/p/lame/svn/trunk/lame/USAGE). Don't know how the internal functionality of mp3 transcoding works (when lowering bitrates) because that is capable of seeking but the convert.conf line does not show any instruction for that. I could probably be using ffmpeg for flac files too but I guess there's no point or added value.
    I was a bit slow in catching this very interesting and learned thread. I've been using equalization for years, and the fact of not being able to seek in mp3 tracks always bugged me: thanks for this solution! Although I don't have many mp3s, I did not like the anomalous behavior.

    May I add a comment. I have noticed that in your equalization you use:
    gain -6.9 equalizer 30 0.43q +6.2
    the difference of -0.7 dB might not leave enough headroom to prevent clipping when applying the math for the equalization. I have noticed this in many occasions, and I run now with gain -3dB even though my equalization is only negative. Although not exactly the same problem, there is a hint of why it is so at this link https://benchmarkmedia.com/blogs/app...-cd-recordings (apologies if is trivial knowledge for you)

    FWIW, I prefer to use an effects file for sox with the command --effects-file=/my/path/to/the/file/sox-effects so that I can more easily tinker with the filters when I feel like, or move around the furniture.

  3. #63
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,982
    Quote Originally Posted by MainSqueeze View Post
    Plugins apparently are "streamMode: I" rather than "R",
    No. This sweeping statement is not correct .

    If you use I - then it tells LMS you want to use STDIN (e.g LMS will hadle http and ICY stuff)
    If you use a rule with R - then LMS will let the trsancode use the $PATH$ or $URL$. (e.g. using ffmpeg to play MP4 streams)

    Some protocol handler (i.e the code than handler http, and/or trasdnport) - may not support "I" transcoding.

  4. #64
    Quote Originally Posted by MainSqueeze View Post
    What I'd like to do is see how far we can take custom-convert (for equalization, room correction, or personal preference, to compensate for room boundaries when positioning speakers, or even just to add reverb to every file played back through LMS if that's what it takes to bring down Babylon), then document what we've learned and post that either here or in a separate thread.
    If I may: user marcoc1712 has made a helper plugin for transcoding, which basically automates the writing of custom-convert.conf, and which allows also sending extra commands to sox https://forums.slimdevices.com/showt...scoding-helper. Although its use case is different (and it does not allow lossy formats) there is probably some useful information in his code, in particular regarding streams.

  5. #65
    Senior Member
    Join Date
    Apr 2005
    Location
    Milan, Italy
    Posts
    617
    Quote Originally Posted by scala View Post
    I was a bit slow in catching this very interesting and learned thread. I've been using equalization for years, and the fact of not being able to seek in mp3 tracks always bugged me: thanks for this solution! Although I don't have many mp3s, I did not like the anomalous behavior.

    May I add a comment. I have noticed that in your equalization you use:
    gain -6.9 equalizer 30 0.43q +6.2
    the difference of -0.7 dB might not leave enough headroom to prevent clipping when applying the math for the equalization. I have noticed this in many occasions, and I run now with gain -3dB even though my equalization is only negative. Although not exactly the same problem, there is a hint of why it is so at this link https://benchmarkmedia.com/blogs/app...-cd-recordings (apologies if is trivial knowledge for you)

    FWIW, I prefer to use an effects file for sox with the command --effects-file=/my/path/to/the/file/sox-effects so that I can more easily tinker with the filters when I feel like, or move around the furniture.
    Glad you found something of use in my tinkering. :-)

    And yeah, having different formats behave differently is something that would bug me A LOT. :-D

    As far as gain is concerned, the values are taken from AutoEQ for my Beyerdynamic DT 880 (https://github.com/jaakkopasanen/Aut...80%20250%20Ohm). So far I've never heard clipping and using EqualizerAPO you've got a setting that automatically lowers volume in case of clipping, it never activated (don't use it for Squeezebox because I wanted to have bitperfect audio, for aestetic reasons more than anything, if I'm being honest).

    As far as the use of an effects file... OMG!!! I already love it! Gonna study this tonight.

    Quote Originally Posted by MainSqueeze View Post
    Easy, Buster. I've got a few other things on, too, you know.
    I was just joking... ;-)

  6. #66
    Junior Member
    Join Date
    Dec 2013
    Location
    London
    Posts
    22
    Well, the short version is: I can extend gorman’s custom-convert to apply equalizer settings to remote streams as well, but in doing so I’m losing the ability to seek within individual streams. The long version follows:

    My test case is a Bandcamp URL:

    Code:
    https://t4.bcbits.com/stream/bd49083b058f575632b3f068c7a448d0/mp3-128/2133326474?p=0&ts=1594389689&t=68fef2d2b76656e8683f1e730ff06bff6fd5deb0&token=1594389689_c819955ff7b75464b8a3f285298ec5ec9c95a07a
    This is the URL that LMS opens when you play back that particular Bandcamp tune (Fela Kuti’s “Sorrow, tears and blood”) via Michael’s Band’s Campout plugin. (It seems that these URLs change over time, but for testing purposes you can use any bc.bits.com URL that you find in your server log while playing back a track on Bandcamp.)

    I’ve chosen Bandcamp because I’ve been using it (and buying music from it) since 2010; unlike others I've tried in the past, e.g. Spotify, Tidal, Deezer, it has the sort of music I like and haven’t yet got in my collection. The URL opens a 128-bit MP3 stream, so sending it through any sort of equalizer or effect is a bit silly. But for a proof of concept it'll do.

    First I wanted to check if playback, transcoding and seek worked outside LMS, so I tried:

    Code:
    # Playback works
    ffplay "https://t4.bcbits.com/stream/bd49083b058f575632b3f068c7a448d0/mp3-128/2133326474?p=0&ts=1594389689&t=68fef2d2b76656e8683f1e730ff06bff6fd5deb0&token=1594389689_c819955ff7b75464b8a3f285298ec5ec9c95a07a"
    
    # Transcoding and seek work
    ffmpeg -ss 2:00 -to 3:00 -i "https://t4.bcbits.com/stream/bd49083b058f575632b3f068c7a448d0/mp3-128/2133326474?p=0&ts=1594389689&t=68fef2d2b76656e8683f1e730ff06bff6fd5deb0&token=1594389689_c819955ff7b75464b8a3f285298ec5ec9c95a07a" -f wav output.wav
    
    # Transcoding, seek and piping the results to sox works
    ffmpeg -loglevel quiet -ss 2:00 -to 3:00 -i "https://t4.bcbits.com/stream/bd49083b058f575632b3f068c7a448d0/mp3-128/2133326474?p=0&ts=1594389689&t=68fef2d2b76656e8683f1e730ff06bff6fd5deb0&token=1594389689_c819955ff7b75464b8a3f285298ec5ec9c95a07a" -f wav - | sox -t wav - -t flac test.flac gain -6 bass -20
    
    # Transcoding, seek, piping through sox and playback on stdout work
    ffmpeg -loglevel quiet -ss 2:00 -to 3:00 -i "https://t4.bcbits.com/stream/bd49083b058f575632b3f068c7a448d0/mp3-128/2133326474?p=0&ts=1594389689&t=68fef2d2b76656e8683f1e730ff06bff6fd5deb0&token=1594389689_c819955ff7b75464b8a3f285298ec5ec9c95a07a" -f wav - | sox -t wav - -t flac - gain -6 bass -20 | play -
    But when I try to apply this to LMS’s custom-convert, I come unstuck. No matter what stream mode I choose (I or R) and whether I use $PATH$ or $FILE$ substitution strings, the results are the same: LMS applies the SoX effects to the stream but when I try to seek within the track, playback pauses – the log reports a “jumpToTime” – then resumes from the beginning of the track.

    The custom-converts I’ve tested:

    Code:
    # version 1
    
    mp3 flc * 00:00:00:00:00:00
    	# F:{PATH=%f}R:{PATH=%F}T:{START=-ss %t}
    	[ffmpeg] -loglevel quiet $START$ -i $PATH$ -f wav - | [sox] -D -q -t wav - -t flac -C 0 -b 24 - bass -20
    
    # version 2, replacing separate F and R variables with FR and $PATH$ with $FILE$
    
    mp3 flc * 00:00:00:00:00:00
    	# FRT:{START=-ss %t}
    	[ffmpeg] -loglevel quiet $START$ -i $FILE$ -f wav - | [sox] -D -q -t wav - -t flac -C 0 -b 24 - bass -20
    
    # version 3, adding an END variable
    
    mp3 flc * 00:00:00:00:00:00
    	# FRT:{START=-ss %t}U:{END=-to %v}
    	[ffmpeg] -loglevel quiet $START$ $END$ -i $FILE$ -f wav - | [sox] -D -q -t wav - -t flac -C 0 -b 24 - bass -20
    Searching the forums for "jumpToTime", Google finds only two pages of results, none of which appear relevant.

    I've attached a server log that shows two "jumpToTime" events.

    What am I missing? (It wouldn’t be the first time I’m missing something obvious.) Or is this simply something that can’t (yet) be done?
    Attached Files Attached Files
    Last edited by MainSqueeze; 2020-07-09 at 08:50.

  7. #67
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,982
    Quote Originally Posted by MainSqueeze View Post
    What am I missing? (It wouldnít be the first time Iím missing something obvious.) Or is this simply something that canít (yet) be done?
    May I suggest a different approach since it looks like you may want to tackle all audio formats on the same player.

    Since the Mac address is 00:00:00:00:00 - is the player a soft player such as squeezelite based ?

    If so, then do equalisation in the player and not in LMS.

  8. #68
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    5,908

    Using Sox to parametrically equalizing I'm losing seek functionality. Could it work?

    Quote Originally Posted by MainSqueeze View Post
    Well, the short version is: I can extend gormanís custom-convert to apply equalizer settings to remote streams as well, but in doing so Iím losing the ability to seek within individual streams. The long version follows:

    My test case is a Bandcamp URL:

    What am I missing? (It wouldnít be the first time Iím missing something obvious.) Or is this simply something that canít (yet) be done?
    Quote Originally Posted by bpa View Post
    May I suggest a different approach since it looks like you may want to tackle all audio formats on the same player.

    Since the Mac address is 00:00:00:00:00 - is the player a soft player such as squeezelite based ?

    If so, then do equalisation in the player and not in LMS.
    @bpa advice is wise and in addition, what you are doing cannot work because the HTTP handler, on top of which band's campout is built does not authorize seeking (canSeek=1) by the transcoding rule. The 'T' flag is ignored. The 'canTranscodeSeek' method would have to be set by the plugin.

    You can seek when using "mp3 mp3" identity rule because the 'I' (stdin) proxying is used and then LMS does the HTTP query of mp3 stream with the right bytes offset, but does not expect the rule itself to do the seek (remember with 'R', doing the right range request query is the transcoder's duty, not LMS')

    So, try using an 'I' flag and not a 'R' and let LMS do the HTTP request with a range for you and use ffmpeg with stdin, not an URL. ffmepg will receive the flac starting at an approximately correct offset and because mp3 has framing, the decoder will resync.

    I'm not sure why "canTranscodeSeek" is disabled in HTTP, it might be an old oversight as not so many rules is default convert.conf use the R flag and none use R and T
    Last edited by philippe_44; 2020-07-11 at 00:45.
    LMS 7.9 on Pi 3B+ & Odroid-C2 - SqueezeAMP!, 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, Riva 1 & 3

Posting Permissions

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