Can't get transcode Flac to MP3 to work

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
hpras
Posts:10
Joined:Mon Feb 22, 2010 9:10 am
AV Hardware:Sony Bravia TV
Can't get transcode Flac to MP3 to work

Post by hpras » Mon Feb 22, 2010 9:49 am

Hi All.

Ubuntu 9.10, TMS 5.1.13 (and 12 and 11). Trying to on the fly transcode FLAC to MP3 to my Sony Bravia. Pounded away at this for 2 nights now. All the FLAC files show up in the Sony menu as MP3's. When i pick on them, I get "cannot play file." and occasionally reboots my TV.

I've created my own flac-mp3.desc.... it is....

# transcode audio (flac to wav)
#(c) 2010 by PacketVideo
#exec: ffmpeg -i $infile $outfile
exec: flac2mp3 $infile $outfile
# capabilities
from=audio/x-flac
to=audio/mpeg

and my own flac2mp3..... it is....

#!/bin/bash
#/usr/bin/flac --silent --decode "$1" | lame -b 192 "$2"
/usr/bin/ffmpeg -i "$1" "$2"

flac2mp3 works from the command prompt.


As you can see with the comments out I've tried a couple things. Here is the the portion of the log file when I try and play a FLAC file........

23:13:53:246 HTTP entering receive module
23:13:53:247 LOG_SYSTEM:upnp_start_thread with ID 0xF6AAAB70
23:13:53:247 LOG_SYSTEM:upnp_init_thread with name HTTP_receive
23:13:53:248 LOG_HTTP:HTTP_send_receive HEAD /cgi-bin/Xflac-mp3.desc/DLNA-PNMP3-OP00-CI1-FLAGS01700000/music/O0$1$7I4044/42.mp3 HTTP/1.1
getcontentFeatures.dlna.org: 1
transferMode.dlna.org: Streaming
X-AV-Physical-Unit-Info: pa="BRAVIA KDL-40W5100";
X-AV-Client-Info: av=5.0; cn="Sony Corporation"; mn="BRAVIA KDL-40W5100"; mv="1.7";
Host: 192.168.1.20:9000


23:13:53:248 http_cgi_handler - requested url /cgi-bin/Xflac-mp3.desc/DLNA-PNMP3-OP00-CI1-FLAGS01700000/music/O0$1$7I4044/42.mp3
23:13:53:248 IsTranscoded - file /var/twonkymedia/db/cache/0ahome2fhans2fMusic2f42.flac(0x0).mp3 will be transcoded now
23:13:53:249 LOG_PLUGIN:system_call_waiting strProg /usr/local/twonkymedia/cgi-bin/
23:13:53:249 LOG_PLUGIN:system_call_waiting strParam flac2mp3
23:13:53:249 LOG_PLUGIN:system_call_waiting waitpid 10467...
23:13:53:254 LOG_PLUGIN:system_call_waiting waitpid 10467 done
23:13:53:254 LOG_HTTP:HTTP_send_header HTTP/1.1 404 Not Found
Content-Type: text/html; charset=utf-8
Content-Length: 132
Date: Mon, 22 Feb 2010 07:13:53 GMT
Pragma: no-cache
Cache-control: no-cache
Accept-Ranges: bytes
Connection: keep-alive
contentFeatures.dlna.org: DLNA.ORG_PN=MP3;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=01700000000000000000000000000000
transferMode.dlna.org: Streaming
EXT:
Server: Linux/2.x.x, UPnP/1.0, pvConnect UPnP SDK/1.0


I can see that it is calling my flac2mp3 script, but it's doesn't look like it's passing $infile and $outfile to the script, so it just stops.
I've added .location files for ffmpeg, lame, mplayer, and flac (I've tried many many things to get this to work), and have tried both symlinks and copying the binaries inthe cgi-bin directory.

So, what am I missing, and why isn't it working?? Thanks

H

User avatar
mgillespie
Posts:1222
Joined:Fri Jul 08, 2005 1:19 pm
AV Hardware:TwonkyMedia AV UPnP Mediaserver (Marvell Kirkwood ARM Sheevaplug with Debian Squeeze).
2x Noxon V2 audio client
1x PS3 Slim 500GB Audio/Video UPnP client.
1x Sony VGF-CP1 Wireless Photoframe.
Location:UK

Re: Can't get transcode Flac to MP3 to work

Post by mgillespie » Mon Feb 22, 2010 9:36 pm

Have you tried this?

http://www.twonkyforum.com/viewtopic.php?f=18&t=7258

(if your TV does not do PCM/WAV, then change the script). In particular, the synchronous bit. That makes the difference between it working and not working on the PS3.

hpras
Posts:10
Joined:Mon Feb 22, 2010 9:10 am
AV Hardware:Sony Bravia TV

Re: Can't get transcode Flac to MP3 to work

Post by hpras » Mon Feb 22, 2010 11:40 pm

I did try that with mixed results. It looked like I could stream WAV to Windows Media Player from FLAC, but the TV doesn't do WAV. The decoded WAV file showed up in the cache. The TV does do LPCM. I tried the script further down that used FFMPEG to create LPCM from FLAC, but no joy there. Once more the Files are shown in the tree, but nothing get transcoded.

hpras
Posts:10
Joined:Mon Feb 22, 2010 9:10 am
AV Hardware:Sony Bravia TV

Re: Can't get transcode Flac to MP3 to work

Post by hpras » Tue Feb 23, 2010 9:41 am

An update.

Another 3 hours scrapping with this. Found an error in my flac-desc.mp3, and extra space was causing trouble. FFMPEG still a no go. Made a new FLAC2MP3 script so I could follow what was happening......

#!/bin/sh
# Converts anything FLAC to mp3
# Usage: flac2mp3 infile outfile

# Command line arguments
INFILE="$1"
UTFILE="$2"

# Lame options
QUALITY=cd
MRE_LAME_ARGS=""
touch /tmp/0
pipe=/tmp/mp3pipe.$$
#rm -f /tmp/out.wav

# Do the conversion
touch /tmp/1
flac --silent --decode "$INFILE" -o /tmp/out.wav
lame -b 196 /tmp/out.wav "$UTFILE"
touch /tmp/2
# Clean up
#rm -f /tmp/out.wav


added the touch statement to see where the script is hanging, and it's isn't!! I have files 1,2 and 3 in my tmp directory as well as out.wav. I also have a 0byte MP3 in the cache that won't play. Once more, the script works fine from the command line. So my guess is that lame is crashing.

hpras
Posts:10
Joined:Mon Feb 22, 2010 9:10 am
AV Hardware:Sony Bravia TV

Re: Can't get transcode Flac to MP3 to work

Post by hpras » Tue Feb 23, 2010 10:08 am

I HAVE IT FIGURED OUT!!!!!!

you have to /dev/null all messages or use the silent flags, else it just crashes.

Locked