Issue with transcoding on Synology

52 views
Skip to first unread message

Christian M

unread,
May 22, 2017, 4:54:29 AM5/22/17
to Sonospy Development
Mark, guys, hello.

It's been a pleasure to follow your guidelines and I'm glad to be close to my goal with my setup. Thanks a lot!

I've setup Sonospy to work on a Synology (DSM 6.1) in a Debian Chroot under Python 2.7.

I have now something that works correctly in SMAPI mode and appears as a service in the configuration panel of Chroot in DSM.

But I'm stuck with the issue that transcoding does not work in my case:
- flac 44.1kHz/24bits and 48/24 play well using direct sonos library but not with SMAPI ("song is not encoded correctly" error)
- flac 88/24 or 96/24 always give encoding error.

I've built and installed ffmpeg because for whatever reason the apt-get gave me problems with the versions of the dependencies. It seems to work correctly.

I tried a few different smapitranscodetable_resolution in transcode.py without success.
Running in debug mode gave the trace attached when trying to play a 96/24 file.
Can you see what's wrong on sox/ffmpeg side? What would you recommend?

pycpointLOG.txt

Mark Henkelis

unread,
May 23, 2017, 5:39:57 PM5/23/17
to sonosp...@googlegroups.com
Hi,

From that log it looks like you've changed smapitranscodetable_extension in transcode.py, and added flac to it. That will cause Sonospy to try and transcode a normal (one that Sonos already plays) flac file, which you don't want - I can see that because you have no debug from lines 84-96 (I'm guessing you've added some lines at the top of the code as the line numbers don't align with the msrefactor5 branch).

There should be no need to amend smapitranscodetable_resolution for your case, in fact that could break things - the current resolution settings are what higher resolution flac is transcoded into, not from. If you put everything back you should see debug from (your) line 96 that shows:

    24_96_2.16_48_2.flac

which is the input resolution (assuming you test with a 96/24/2 file).

If you get that then you will hit the code at (your) line 316 (add a debug statement to check), which just uses sox to transcode the higher resolution flac. Assuming you have installed sox, you can try running that command line with it to see if you get an error. It's possible that it's failing to open a sub-process, so also print out the sub variable after the call to see whether that shows an error.

Mark.
--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.
To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

Christian M

unread,
May 24, 2017, 4:10:47 PM5/24/17
to Sonospy Development
Hi,

Thanks for your help, you're right. Now I'm back with the original transcode.py and I logged sub.pid and sub.returncode. I get this:

DEBUG   transcode   : 111:  transcode() /music/Test/96.24.flac
DEBUG   transcode   : 112:  transcode() 24_96_2.16_48_2.flac
DEBUG   transcode   : 324:  transcode() 4620
DEBUG   transcode   : 325:  transcode() None

I still receive a Sonos error and I see that my sox process is zombie:

root      4620  0.2  0.0      0     0 ?        Z    21:56   0:00 [sox] <defunct>

I checked sox typing directly the command below and everything goes fine with a readable new file.

 sox 96.24.flac -C 0 -b 16 -r 48000 -t flac 48.16.flac

I could not get any information on the Popen subprocess, though.

Christian

Christian M

unread,
May 24, 2017, 4:33:11 PM5/24/17
to Sonospy Development
Oh, and adding this block
        sub = subprocess.Popen([
                "sox",
                inputfile,
                "-C", "0",
                "-b", "16",
                "-r", "48000",
                "-t", "flac",
                "-"],
                stdout=subprocess.PIPE,
                stderr=devnull)
        for line in sub.stdout:
            line = line.rstrip()
            log.debug(line)

I fill the log file with a nice FLAC-looking text so it's getting stuck in the pipe somewhere.

DEBUG   transcode   : 326:  transcode() fLaC^@^@^@"^D<80>^D<80>^@^@^@^@^@^@^K¸^Bð^@®Fc^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^C^@^A°^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^GS^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^N¦^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^Uù^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^]L^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$<9f>^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@+ò^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@3E^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@:<98>^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Aë^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@I>^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@P<91>^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Wä^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@_7^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@f<8a>^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@mÝ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@u0^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@|<83>^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@<83>Ö^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@<8b>)^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@<92>|^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@<99>Ï^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@¡"^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@¨u^@^@^@^@^@^@^@^@^@^@^@<84>^@^Aç ^@^@^@reference libFLAC 1.3.0 20130526^K^@^@^@^M^@^@^@TRACKTOTAL=13^K^@^@^@DISCTOTAL=1^R^@^@^@COPYRIGHT=Columbia^L^A^@^@DESCRIPTION=Interprètes : Depeche Mode, Performer; Martin L. Gore, Composer; Martin L. Gore, Lyricist; Ben Hillier, Producer; Christoffer Berg, Misc. Prod.; Ferg Peterkin, Engineer; Kurt Uenala, Misc. Prod.; Tomas Deltoro-Diaz, Assistant Engineer; Will Loomis, Ass...^S^@^@^@Album=Delta Machine^L^@^@^@DISCNUMBER=1^S^@^@^@Artist=Depeche Mode^K^@^@^@title=96.24

Mark Henkelis

unread,
May 26, 2017, 7:32:26 PM5/26/17
to sonosp...@googlegroups.com
If you capture the file from the sox command line, will that play in Sonos?

Christian M

unread,
May 27, 2017, 3:00:12 PM5/27/17
to Sonospy Development
Yes, the one I generate with a sox command line plays well and has the same tags as the original. I don't know how to capture the PIPE from trancode.py into a file though.

Wierdly, when I added log.debugging of the sub.stdout in transcode.py, sonos PC interface didn't show the usual error message when playing but the status bar started to progress (without sound) and after a few staggering moves, a new error appears "Unable to play. The connection was lost".

Reply all
Reply to author
Forward
0 new messages