Page 1 of 2

How to transcode Apple lossless (m4a)?

PostPosted: Thu Jan 15, 2009 9:02 pm
by volcs0
The regular way to transcode m4a does not work (faad --> lame). To transcode apple lossless, you need something else, like xld or mplayer or ffmpeg (or something else?).

xld will transcode to wav, but I cannot get that program to pipe to stdout.

Any other ideas?

Thanks.

PostPosted: Tue Feb 10, 2009 3:26 pm
by Ikyo
What kind of machine are you using this on?

PostPosted: Tue Feb 10, 2009 7:38 pm
by volcs0
Ikyo wrote:What kind of machine are you using this on?


A Mac.

PostPosted: Wed Mar 04, 2009 2:54 pm
by Ikyo
Try using this in the transcode:

m4a2mp3 %s %b

Create a shell script called m4a2mp3 with:

Code: Select all
#!/bin/bash
song=$1
bitrate=$2

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



This will actually transcode pretty much anything into a mp3 that ffmpeg can read. Make sure you have ffmpeg in the transcode folder or change the script to reference the installed location.

PostPosted: Wed Mar 04, 2009 10:28 pm
by volcs0
Worked great. Thanks.

One thing that tripped me up - I didn't realize that all the commands had to actually be in the transcode folder (I know it says this, but I missed this in the upgrade). So even though they are in my path, Subsonic was not finding them. I tried creating a symbolic link, but that didn't work either. So I ended up just writing the script to the transcode folder. I'll have to remember to save that folder when I upgrade again.

Thanks for the help.

PostPosted: Thu Mar 05, 2009 3:05 pm
by Ikyo
No problem at all...I use that to play pretty much everything from wma to m4a.

PostPosted: Fri Mar 06, 2009 4:14 pm
by mancubus220
I'm trying to transcode flac and wma files to mp3. I have flac codec installed and linked to, but its not working with the default subsonic transcode command, which is why I'm trying the ffmpeg method. I have ffmpeg installed and I've run your script from the command line (not the smartest idea but wanted to verify it ran without errors). This script isnt working in subsonic though and I can't figure out why. The script I created in /var/subsonic/transcode is executable by all users. There are no errors in the subsonic log. The Tomcat log has unrelated errors about not being able to create thumbnails but nothing about transcoding. I'm running gentoo linux (I've enabled most of the relevant ffmpeg compile flags I'm pretty sure). I've looked just about everywhere I can think of for why it's not working. I'm inclined to think its a problem with subsonic and not ffmpeg, but how would I confirm this? I'm running this on a headless machine without speakers.

PostPosted: Fri Mar 06, 2009 4:20 pm
by mancubus220
Doh, I figured it out within a few minutes of that last post...and it was a pretty simple thing...I had restarted tomcat several times and cleared the playlist thinking that would cause my new transcoding settings to take effect, but I didn't realize you had to activate them for each player (I'm using the web player). After I did that, everything works swell. I might suggest a more intuitive interface for future revisions! :)

PostPosted: Fri Mar 06, 2009 4:25 pm
by Ikyo
When I was testing some things, I did it too. You should see the first script that I was using to work on this.

PostPosted: Fri Mar 06, 2009 5:08 pm
by mancubus220
I imagine using ffmpeg (one command) is a lot faster than decoding with one codec and then encoding with another (like lame). Internally, ffmpeg probably does it too but I bet they have optimizations to make it run faster. This is good because flac playback used to be really slow for me with the old method.

PostPosted: Wed Apr 15, 2009 12:32 am
by dobson
I'm sorry to ask basic questions. I've tried for quite a while now and I'm still unable to get this to work for me. using LAME 3.98.2, FFmpeg v0.5.

when I follow "m4a2mp3" shell tip, here is the error I get from the log:
java.io.IOException: /var/subsonic/transcode/m4a2mp3: not found
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:52).....
{the list goes on for a while}


however, I have the "m4a2mp3.sh" script in the transcode directory, and here are the permissions for all the files in that directory.

lrwxr-xr-x 1 root wheel 13 Apr 14 16:42 faac -> /usr/bin/faac
lrwxr-xr-x 1 root wheel 13 Apr 14 15:56 faad -> /usr/bin/faad
lrwxr-xr-x 1 root wheel 15 Apr 14 16:41 ffmpeg -> /usr/bin/ffmpeg
lrwxr-xr-x 1 root wheel 18 Apr 14 16:42 ffmserver -> /usr/bin/ffmserver
lrwxr-xr-x 1 root wheel 13 Apr 14 15:56 lame -> /usr/bin/lame
-rwxr-xr-x 1 root wheel 110 Apr 13 23:34 m4a2mp3.sh

any ideas?
thanks so much for all the help. subsonic is really wonderful.

PostPosted: Wed Apr 15, 2009 1:43 am
by dobson
forgot to mention, I'm using OS X 10.5.6 for what it's worth.

and the transcode setting I have for m4a > mp3 is
Step 1: m4a2mp3 %s %b
Step 2: blank

enable, and active in the player.

PostPosted: Wed Apr 15, 2009 5:34 am
by sindre_mehus
Probably you need to specify m4a2mp3.sh in step 1. (Including the .sh extension)

PostPosted: Wed Apr 15, 2009 2:09 pm
by dobson
thank you Sindre!
i tried that before (when I had other issues with ffmpeg) and it didn't work, so i forgot to try it again after figuring out those issues. now it's playing my lossless files great.

it's *mostly* working now except for this:
when a lossless m4a (but not a lossy m4a) song is loaded into the flash player, I get a problem with the flash player time very similar to the one described here:
Transcoding breaks Flash player's progress bar?

has anyone else experienced that when transcoding m4a lossless?

(using subsonic v3.6-build 806)

PostPosted: Wed Apr 15, 2009 7:23 pm
by sindre_mehus
If the problem is what I think it is, it's been fixed in 3.7.