How to transcode Apple lossless (m4a)?

Need help? Post your questions here.

Moderator: moderators

How to transcode Apple lossless (m4a)?

Postby volcs0 » Thu Jan 15, 2009 9:02 pm

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.
volcs0
 
Posts: 22
Joined: Wed Nov 12, 2008 3:50 pm

Postby Ikyo » Tue Feb 10, 2009 3:26 pm

What kind of machine are you using this on?
Ikyo
 
Posts: 58
Joined: Wed Nov 30, 2005 12:07 am

Postby volcs0 » Tue Feb 10, 2009 7:38 pm

Ikyo wrote:What kind of machine are you using this on?


A Mac.
volcs0
 
Posts: 22
Joined: Wed Nov 12, 2008 3:50 pm

Postby Ikyo » Wed Mar 04, 2009 2:54 pm

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.
Ikyo
 
Posts: 58
Joined: Wed Nov 30, 2005 12:07 am

Postby volcs0 » Wed Mar 04, 2009 10:28 pm

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.
volcs0
 
Posts: 22
Joined: Wed Nov 12, 2008 3:50 pm

Postby Ikyo » Thu Mar 05, 2009 3:05 pm

No problem at all...I use that to play pretty much everything from wma to m4a.
Ikyo
 
Posts: 58
Joined: Wed Nov 30, 2005 12:07 am

Postby mancubus220 » Fri Mar 06, 2009 4:14 pm

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.
mancubus220
 
Posts: 7
Joined: Fri Mar 06, 2009 3:51 pm

Postby mancubus220 » Fri Mar 06, 2009 4:20 pm

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! :)
mancubus220
 
Posts: 7
Joined: Fri Mar 06, 2009 3:51 pm

Postby Ikyo » Fri Mar 06, 2009 4:25 pm

When I was testing some things, I did it too. You should see the first script that I was using to work on this.
Ikyo
 
Posts: 58
Joined: Wed Nov 30, 2005 12:07 am

Postby mancubus220 » Fri Mar 06, 2009 5:08 pm

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.
mancubus220
 
Posts: 7
Joined: Fri Mar 06, 2009 3:51 pm

Postby dobson » Wed Apr 15, 2009 12:32 am

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.
dobson
 
Posts: 46
Joined: Tue Apr 14, 2009 10:10 pm

Postby dobson » Wed Apr 15, 2009 1:43 am

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.
dobson
 
Posts: 46
Joined: Tue Apr 14, 2009 10:10 pm

Postby sindre_mehus » Wed Apr 15, 2009 5:34 am

Probably you need to specify m4a2mp3.sh in step 1. (Including the .sh extension)
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway

Postby dobson » Wed Apr 15, 2009 2:09 pm

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)
dobson
 
Posts: 46
Joined: Tue Apr 14, 2009 10:10 pm

Postby sindre_mehus » Wed Apr 15, 2009 7:23 pm

If the problem is what I think it is, it's been fixed in 3.7.
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway

Next

Return to Help

Who is online

Users browsing this forum: No registered users and 18 guests