How to transcode to HE-AAC in iSub

Tutorials, tips and tricks.

Moderator: moderators

How to transcode to HE-AAC in iSub

Postby kingmos » Fri May 25, 2012 12:17 pm

Hi guys,

I thought it would be time to do a tutorial for transcoding to HE-AAC with ffmpeg and iSub. This has been discussed over and over again so here we go:

First of all: this doesn't work in Subsonic 4.6 since a change in the transcoding engine. The streams start to play and then sometime just stop before they should. I hope this gets fixed in 4.7. So what we need is Subsonic 4.5

I did this on a rather clean Debian Squeeze (OpenMediaVault), building in Ubuntu should work the same way.

We'll need a lot of files to let's go to the tmp folder first:
Code: Select all
# cd /tmp


prerequisites:
Code: Select all
# sudo apt-get install autoconf libtool make git yasm pkg-config automake libavcodec52


LibAACplus
Code: Select all
# wget http://217.20.164.161/~tipok/aacplus/libaacplus-2.0.2.tar.gz
# tar -xvf libaacplus-2.0.2.tar.gz
# cd libaacplus-2.0.2
# ./autogen.sh --enable-shared
# make
# sudo make install
# cd ..



FFMPEG
Code: Select all
# git clone git://source.ffmpeg.org/ffmpeg.git
# cd ffmpeg
# ./configure --enable-gpl --enable-pthreads --enable-libaacplus --enable-nonfree
# make


Move to subsonic transcode folder
Code: Select all
# mv ffmpeg /var/subsonic/transcode/ffmpeg_heaac


Make wrapper script
Code: Select all
# cd /var/subsonic/transcode/
# nano wrapper.sh


insert:
Code: Select all
#!/bin/sh
NAME=wrapper.sh
IFS=$''

S=$2
BITRATE=$1k
BITRATEAAC=`expr $1 / 2`k

if [ $1 -eq 320 ]
      #pipe
      then cat "$2"
   elif [ $1 -le 128 ]
      #he-aac
      then /var/subsonic/transcode/ffmpeg_heaac -v warning -i "$2" -f adts -vn -acodec libaacplus -ar 44100 -ab $BITRATEAAC -ac 2 -
   #mp3
   else /var/subsonic/transcode/ffmpeg -v warning -i "$2" -ab $BITRATE -v 0 -f mp3 -
fi


make executable
Code: Select all
# chmod +x wrapper.sh


So what does this script? Several things, according to the bitrate asked by iSub:
Bitrate 64 - 128 gets you HE-AAC files with half the bitrate set. So when you tell iSub to transcode to 128kbit you'll get 64kbit HE-AAC. For 64kbit you'll get 32kbit HE-AAC.
Bitrate 160 - 256 gets you MP3 with bitrates 160kbit - 256kbit.
Bitrate 320 gives you the original file without transcoding.

I set my iSub to Wifi: 320 and 3G: 128 and get the original files in Wifi and HE-AAC with 64kbit in 3G.

finally the subsonic transcoding:
m4a > aac | m4a | aac | wrapper.sh %b %s
mp3 > aac | mp3 | aac | wrapper.sh %b %s
flac > aac | flac | aac | wrapper.sh %b %s

Happy streaming!
kingmos
kingmos
 
Posts: 13
Joined: Thu Oct 14, 2010 2:51 pm

Re: How to transcode to HE-AAC in iSub

Postby IceSheep » Wed May 30, 2012 6:24 pm

Starting with iSub 3.0.8 this works with Subsonic 4.6 and most likely also 4.7beta.

I got this running on Ubuntu 12.04. Thanks for the great tutorial! This is really useful.

Cheers!
IceSheep
 
Posts: 1
Joined: Wed May 30, 2012 6:17 pm


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 12 guests