Strange problems with transcoding to LPCM

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
alza
Posts: 1
Joined: Sun Oct 02, 2011 7:52 pm
AV Hardware: Sony NAS-C5E

Strange problems with transcoding to LPCM

Post by alza » Sun Oct 02, 2011 10:12 pm

Hi all,

I have been trying to setup TwonkyServer 6.0.37 on a Fedora 12 Linux server, with transcoding to LPCM format configured.

This is because most of my music is in m4a format and one of my playback devices doesn't support m4a, but it does support LPCM; the device is a Sony NAS-C5E which is allegedly DNLA compliant.

In summary, the transcoding is working up to the point where TwonkyServer calls ffmpeg to create a valid lpcm output file, but when the device requests the lpcm resource over HTTP, the transcoded lpcm file is not sent, instead it appears that the original file is being sent, which results in a continuous white noise output from the device...!

In detail then, what follows is a description of the steps I took to reach the above problem. I read up on what transcoding documentation I could find (mostly in this forum!) and configured TwonkyServer using the following steps:

- Install TwonkyServer using the .sh download
- Edit /etc/init.d/twonkyserver to remove '-D' from the arguments used to start the server, in order for transcoding to work (reference: http://www.twonkyforum.com/mediawiki/in ... ranscoding)
- Edit /usr/local/twonkymedia/cgi-bin/ffmpeg.location to point to the location of the 'ffmpeg' executable ('/usr/bin' in this case)
- Create /usr/local/twonkymedia/cgi-bin/ffmpeg-any-lpcm.desc with the following contents:

exec: ffmpeg -i $infile -f s16be -ac 2 -ar 44100 $outfile
from=audio/*
to=audio/L16
asynchronous
priority=idle

- Modify /usr/local/twonkymedia/resources/clients.db to add the following device:

>>
NA:Sony NAS-C5E
HH:NAS-C5E
XM:DLNA10
TR:LPCM
DB:FIX

- Finally, restart TwonkyServer
- Open a browser to the configuration screen
- Enable logging
- Leave background transcoding unchecked (I only want on-the-fly transcoding)
- Check that the device is using the correct client configuration ('Sony NAS-C5E')

Now, on the device I accessed the TwonkyServer and browsed to a music track that is in m4a format. When I selected to play it, I could see TwonkyServer call ffmpeg to create the transcoded LPCM output file. However, from the device I just heard continuous white noise!

To check the LPCM output file, I opened it in an audio editing program, and after specifying it as 'LPCM/16bit/44100/2channel/bigendian' it played back fine; this indicates that ffmpeg is producing a correct file.

After a little bit of investigation looking at the TwonkyServer logs, I saw that the client is requesting urls like the following for the LPCM resource:

http://twonkyserver/cgi-bin/Xffmpeg-any ... I3083.lpcm

So, as a test I used wget to download the same resource to inspect it. The results were very unusual, from the file size of the download it seems that TwonkyServer is sending the original m4a file instead of the transcoded LPCM file:

Original m4a file size = 3424909
Transcoded LPCM file size = 24788992
Downloaded file size using wget = 3424865

Notice how the downloaded file is roughly the same size as the original file, give or take a few bytes.

My question to the TwonkyServer developers, why is the transcoded output file not being sent as this would seem to be the correct behaviour? It looks like a bug, is it a known bug?

Thanks

Alex.

raphaugusto
Posts: 1
Joined: Thu Oct 13, 2011 4:50 am
AV Hardware: SAMSUNG TV, SKY HDTV (DirectTV), XBOX 360, My Book World Edition II

Re: Strange problems with transcoding to LPCM

Post by raphaugusto » Thu Oct 13, 2011 5:03 am

I have the same issue.

Sever version: 6.0.34
Client: Sky HDTV box

Any suggestions will be appreciated. :idea:

michel-rose
Posts: 6
Joined: Sun Jan 15, 2012 8:07 pm
AV Hardware: Sony Bravia w5500, Linn DS, Qnap with twonky

Re: Strange problems with transcoding to LPCM

Post by michel-rose » Mon Aug 13, 2012 10:47 am

And the story continues

Using Twonky 7.0.9 on my windows 7 pc i have the same problem
When trying to play flac files using WMP or Bravia i hear a hiss (white noise).
I have made the following changes to make transcoding work

Create file "flac-lpcm.desc"
# transcode audio (FLAC to LPCM)
exec: flac $infile -d -o $outfile
# capabilities
from=audio/x-flac
to=LPCM
asynchronous
priority=idle

Copied the flac.exe in the cgi-bin folder
Restart twonky.

Start WMP and select library "twonky".
Opening the album shows the titles of the files and a blue dot in with exclamation mark in front "This file is of an unrecognize type which may not be playable in WMP"
When selecting a file to play, i get white noise and i can see that the duration time of the song is reduced from 5:16 => 3:03
Same for my Bravia, when i select the files all i hear is white noise.

After changing the transcode.db
# additional audio res elements
#LPCM,lpcm,audio/L16,LPCM
LPCM,lpcm,audio/L16

I get a slightly different result.
WMP shows titles without blue dot and exclamation mark
When playing the file i get white noise
Duration of the file is correct

On the Bravia the file is not shown anymore. I guess since it has lost the LPCM dlna profile.

I have checked the files (example Lovesong.flac.lpcm and they play fine in both WMP and Bravia
(for playing on my Bravia i copied the file to the appropriate folder)

Tried different decoders and options like
# transcode audio (FLAC to LPCM)
exec: ffmpeg -i $infile -f s16le $outfile (or ffmpeg -i $infile -f s16be $outfile)
# capabilities
from=audio/x-flac
to=LPCM
asynchronous
priority=idle

All have the same result, :(
So i thought to give transcoding to WAV a chance

Created a new file flac-wav.desc and delete the previous flac-lpcm.desc
# transcode audio (FLAC to WAV)
exec: flac $infile -d -o $outfile
# capabilities
from=audio/x-flac
to=WAV
asynchronous
priority=idle

Restart twonky
Start WMP and select library "twonky".
Opening the album shows the titles of the files and a blue dot in with exclamatoin mark.
Music play fine however.

With heaps of hope i turn on the tv and browse to the music folder.
Sadly the TV says "No files to display"

So transcoding to LPCM does not seem to work and when transcoding to wav my bravia will not show the files.
What is going wrong...

The files created (flac, wav) are exactly the same..

Other options
ranscoding to MP3 (not enough cpu speed available)
buy another mediaplayer (not an option)

Hope someone can help

Kind regards, Michel Rose

User avatar
phibertron
Posts: 1566
Joined: Sun Jan 30, 2011 5:52 pm
AV Hardware: Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Strange problems with transcoding to LPCM

Post by phibertron » Tue Aug 14, 2012 7:42 pm

For those intrested, the site was down after the topic was posted
But did continue in the following thread, the second half of it

http://community.twonky.com/twonky/topi ... _windows_7
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

Locked