Page 1 of 2

Decoding wma on linux server

PostPosted: Wed May 09, 2007 9:32 pm
by PT
I've got subsonic installed on a fresh install of fedora core 6 and it works fine for mp3's. Is there any way to play .wma files on this setup. Transcoding suggests wmadec but it looks like this is only available on Windows.

Anyone have any ideas?

Regards

PT

PostPosted: Sun Dec 30, 2007 3:31 am
by Ikyo
I think that I was able to finally get this working after about 10 hours today doing a ton of research and getting the mplayer to output to standard out. I am attaching a script that you must have in your transcode folder and place these into the steps:

Step 1: wma2mp3 %s
Step 2: lame -b %b - -

Here is the script and make sure to don't have it line wrap:

#!/bin/bash
mplayer -vo null -msglevel all=-1 -quiet -srate 44100 -channels 2 -vc dummy -ao pcm:nowaveheader:fast:file=/dev/stdout $1 2>/dev/null


I am hoping that will help you out in playing wma's in Linux.

PostPosted: Fri Jan 18, 2008 6:51 am
by Ikyo
I made one error on the shell script. Use this (without the word wrap):

#!/bin/bash
song=$1
mplayer -vo null -msglevel all=-1 -quiet -srate 44100 -channels 2 -vc dummy -ao pcm:nowaveheader:fast:file=/dev/stdout "$song" 2>/dev/null

PostPosted: Fri Jan 18, 2008 4:13 pm
by Ikyo
Anyone have a chance to give this a try? I am wondering if it is working okay for everyone.

PostPosted: Tue Feb 12, 2008 1:30 am
by braddyo
Your solution worked great except for one thing:

At the beginning of every song there is a click, like the sound you can imagine an arrow making if it were shot into a tree.

Do you know if it is possible to get ffmpeg to work? That would be able to transcode I believe without using lame and eliminating that step. In fact, I wonder why Sindre doesn't use ffmpeg for all the transcoding and have it built in.

PostPosted: Thu Feb 21, 2008 4:49 am
by Ikyo
I will have to try it on my machines here. I am not sure why you are getting that. I am wondering if it has something to do with buffering. I also haven't tried ffmpeg. Does it understand WMA by default and able to output to the stdout?

PostPosted: Thu Feb 21, 2008 6:58 am
by Ikyo
After doing some testing, I am thinking it might have something to do with mplayer and how it outputs to the stdout. I am not 100% sure on this, but this is my initial guess. I tried lame by itself to convert a wave file and it was perfect.

PostPosted: Thu Feb 21, 2008 7:53 am
by Ikyo
Try this if you have ffmpeg:

Transcode line: wma2mp3 %s %b

wma2mp3:

#!/bin/bash
song=$1
bitrate=$2

ffmpeg -i "$song" -f mp3 -ab $bitrate - 2>/dev/null

Works with proper libavcodec

PostPosted: Thu Feb 05, 2009 12:08 am
by jeremyh
Ikyo, I tried your solution under Ubuntu 8.10 (Intrepid) and it gave me a failure message "unable to find suitable output codec for 'pipe'" (when running at command line). This was strange because I could do the conversion if I replaced stdout ("-") with a file. As soon as I replaced the file with "- >file" it would fail again.

I updated libavcodec51 to libavcodec-unstripped-51 and it resolved the problem.

Since ffmpeg uses libavcodec underneath, I am guessing there is an unofficial codec that is necessary to dump the ffmpeg output stream to stdout.

PostPosted: Thu Apr 23, 2009 1:31 am
by dobson
to pick this thread up again...
I'm running Subsonic standalone on OS X 10.5.6 and trying to transcode and stream wma lossless. I'm using Ikyo's suggestion with ffmpeg (v0.5) compiled with libmp3lame and a whole slew of other options. and using libavcodec.52.dylib and libavcodec.52.20.0.dylib

wma2mp3:

#!/bin/bash
song=$1
bitrate=$2

ffmpeg -i "$song" -f mp3 -ab $bitrate - 2>/dev/null


I'm still unable to transcode wma lossless files. but there is no notable error message in the subsonic log. when I try the ffmpeg command from the terminal, I get the error "Unsupported codec (id=86057) for input stream #0.0" leading me to believe ffmpeg is just not capable of decoding wma lossless... but I thought that it was as of 0.5. am I incorrect? is it simply lossy version of wma? (please excuse my lack of knowledge about the wma codec)

any suggestions on where to go with this? should ffmpeg (0.5) theoretically be able to transcode wma lossless? or am I barking up the wrong tree?

PostPosted: Sun Jul 19, 2009 6:19 pm
by tfruitz
i'm using debian lenny with subsonic 3.7 and found this script to work:

#!/bin/bash
song=$1
bitrate=$2

ffmpeg -i "$song" -f wav -ab $bitrate - 2>/dev/null


the mp3 format is not recognized by lame. funny. Although the music plays, at around 2:43 the music suddenly stops. Does anybody know why?


A by-note: wma2mp3 needs to be executable by running: chmod +x wma2mp3

PostPosted: Sun Aug 09, 2009 10:38 pm
by aTommyC
/usr/bin/wma2wav:

#!/bin/bash
song=$1

ffmpeg -i "$song" -f wav - 2>/dev/null


And within Transcoding setup:

wma > mp3 | wma | mp3 | wma2wav %s | lame -b %b - -

Did the trick for me.

Edit: I also renamed the wma2mp3 script to wma2wav, giving it a bit more intuitive and descriptive name. After all, that's what it really does. :)

PostPosted: Tue Aug 18, 2009 3:26 am
by Fman99
I've been pounding this into the ground and can't get my Linux box to properly transcode the wma files I have. I even re-OS'd my box from Fedora to Debian and all to no avail.

I have both mplayer and ffmpeg installed, and I can convert successfully from wma to mp3 using ffmpeg on the command line. I tested it using one of my wma files and I can play the outputted mp3.

But when I try and set up the subsonic player (using the web interface to set it up) to transcode my remaining wma's I get nothing. Also, my subsonic install cannot play the MP3 that I did transcode successfully, even though I can play the file locally on a player.

Any help is appreciated......

PostPosted: Fri Nov 13, 2009 6:56 am
by daniell
I still don't get it.....:-)
I'm new here, and to subsonic, fanastic application, i love it.. But i'm still not able to play wav and wma files. Is there a how to do tutorial for dummies. ?
Have already install Lame and flac, they works greate.. Anything more i need to install to be able to play these files.?? I'm running ubuntu server. thnks

Props

PostPosted: Wed Jan 27, 2010 6:26 pm
by Tanner Williamson
aTommyC wrote:/usr/bin/wma2wav:

#!/bin/bash
song=$1

ffmpeg -i "$song" -f wav - 2>/dev/null


And within Transcoding setup:

wma > mp3 | wma | mp3 | wma2wav %s | lame -b %b - -

Did the trick for me.

Edit: I also renamed the wma2mp3 script to wma2wav, giving it a bit more intuitive and descriptive name. After all, that's what it really does. :)


@aTommyC
Thank you, this worked for me on my CentOS 5.4 x86_64.

Notes and tips to future comers on this thread who may need help implementing this. These instructions provided here will apply to anyone using Fedora, RHEL/CentOS, or such-based distros.


  1. [have already, or now] install ffmpeg and libavcodec
  2. place the suggested script into the file at /var/subsonic/transcode/wma2wav
  3. chmod 0755 /var/subsonic/transcode/wma2wav


Alternately, you can place the wma2wav script in your /usr/local/bin/ or your /usr/bin/ directory. If doing so, just adjust the chmod command above to target the location you have placed the file in. As I wanted to keep my subsonic tweaks together as much as possible, so that I can easily clone my installation, I chose to put them in the /var/subsonic/transcode/ directory.