Strange problems with transcoding to LPCM
Posted: 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.
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.