Subsonic

Jul 14, 2011·
Julio Batista Silva
Julio Batista Silva
· 4 min read
blog iPhone
These days I use Jellyfin and Plex

Subsonic is an open source media server that can stream your whole music and video library to any phone or computer connected to the internet. It works like VLC, but has several extra features, such as transcoding on the fly and scrobble to Last.fm.

Have a look at the demo to get a better idea: http://www.subsonic.org/pages/demo.jsp

Subsonic is cross-platform, since it is written in Java. It can be installed on its own (standalone) or as a Web Application Archive. Here I used the standalone form because it is simpler.

  1. Install all the dependencies

    julio@julio-acer ~ $ sudo pacman -S jre lame ffmpeg flac
    
  2. Download and install subsonic, available on the AUR

  3. Edit the startup script

    julio@julio-acer ~ $ sudo vim /var/subsonic/subsonic.sh
    SUBSONIC_HOME=/var/subsonic
    SUBSONIC_HOST=0.0.0.0
    SUBSONIC_PORT=4040
    SUBSONIC_HTTPS_PORT=0
    SUBSONIC_CONTEXT_PATH=/
    SUBSONIC_MAX_MEMORY=200
    SUBSONIC_PIDFILE=
    SUBSONIC_DEFAULT_MUSIC_FOLDER=/media/externo/Musicas
    SUBSONIC_DEFAULT_PODCAST_FOLDER=/var/music/Podcast
    SUBSONIC_DEFAULT_PLAYLIST_FOLDER=/var/playlists
    export LC_CTYPE=en_US.UTF-8
    
    quiet=0
    

    Leave SUBSONIC_HOST as 0.0.0.0, so you will have access from any computer. Change it to 127.0.0.1 if you only want local access.

    The HTTPS_PORT is not required, but you can set it as SUBSONIC_HTTPS_PORT=4041. You will also need to configure SSL.

    I added the last line with an export because I had trouble with accented folders and files, and that solved the problem. Other variables you might export can be seen with $ locale.

  4. If, in the step above, you left the default music folder, create a symbolic link in /var/music pointing to the music folder on your drive. For example:

    julio@julio-acer ~ $ sudo ln -s /media/externo/Musicas/ /var/music/
    

    In any case, you can add music and video folders later through the web interface.

  5. Run the script you have just edited

    julio@julio-acer ~ $ sudo /var/subsonic/subsonic.sh
    Started Subsonic [PID 7635, /var/subsonic/subsonic_sh.log]
    
  6. Go to http://localhost:4040 and change the default password to a safer one

  7. Settings:

    • Music folders: Set the music folders to be reached
    • General: Set the playlist folder, language, theme and messages
    • Advanced: Configure LAME
    • Personal: User settings, such as the avatar and the lastfm account
    • Users: Create new users, edit their permissions and change their password. Besides admin, I recommend creating another user with fewer permissions, to follow the principle of least privilege.
    • Players: Set the players and the transcodes
    • Network: Do NOT check the “Automatically configure your router to allow incoming connections to Subsonic” option, since we are going to open the port by hand.

    Check “Access your server over the Internet using an easy-to-remember address.” and put in any user name (jbsilva is mine). You can use that account free for 30 days; after that you have to donate 10 euros or use an external service such as DynDNS (explained below).

    Open the router’s page (10.0.0.1 here).

    Under LANSetup, reserve the IP 10.0.0.2 for the computer running Subsonic.

    Under Port Forwarding, click Add Custom Service and fill in the following details:

    Service Name: Subsonic
    Service Type: TCP/UDP
    Starting Port: 4040
    Ending Port: 4040
    Server IP Adress: 10.0.0.2
    

    Test the settings by checking whether the router forwarded port 4040 to your computer.

    Example: http://189.19.170.215:4040/ and http://jbsilva.subsonic.org should show Subsonic’s login screen.

    • Transcoding: Add commands for converting between formats.
    • Internet TV/radio: Add links to online TV/radio streams.
    • Podcast: Configures podcast downloads
    • Search: Configures the index update for searches
  8. Create a symbolic link for each program used for transcodes:

    julio@julio-acer ~ $ sudo ln -s /usr/bin/lame /var/subsonic/transcode/
    julio@julio-acer ~ $ sudo ln -s /usr/bin/flac /var/subsonic/transcode/
    julio@julio-acer ~ $ sudo ln -s /usr/bin/ffmpeg /var/subsonic/transcode/
    

iPhone

Since the flash player in the web interface does not work on the iPhone, the best solution is to install an App.

I only found free Apps for Android; for the iPhone I found two at $4.99: iSub and Z-Subsonic.

Here I will talk about iSub, which I downloaded because it is more popular and because, from the reviews I read, iSub handles albums and covers better. Maybe one day I will try Z-Subsonic. If you want a tutorial for configuring Z-Subsonic, the developer wrote one: http://blog.intulon.com/?p=8

Configuring iSub is quite simple.

  1. Download the App from the AppStore and open it

  2. Click Settings -> Servers

  3. Add a new server

    If you use Subsonic’s own address, just put http://jbsilva.subsonic.org, without the port.
    But if you use dynDNS configured as in the tutorial I linked in the next section, include the port too.
    E.g.: http://jbsilva.dyndns.org:4040 or http://casa.juliobs.com:4040/

  4. Under settings » settings, turn on scrobbling to Last.fm and limit the bitrate over 3G.

Dynamic DNS

After 30 days you will not be able to reach your files through the address Subsonic provides (http://jbsilva.subsonic.org).
You will have to donate at least 10 euros to Subsonic, reach your computer directly by IP, or use a dynamic DNS service to tie your computer’s dynamic IP to a static address.

I wrote a post explaining the whole process of creating and configuring a hostname on DynDNS. Click HERE to read it.


Julio Batista Silva
Authors
Senior Cloud Developer

I’m a Brazilian-German computer engineer based in Germany, passionate about tech, science, photography, and languages.

I’ve been programming for about two decades already, exploring everything from mobile apps and web development to machine learning. These days I focus on cloud SRE and data engineering.

I volunteer in the open source and Python communities, helping organize PyCon DE and PyData Berlin, serving on the PSF D&I Work Group, mentoring, and contributing code and translations.

On my blog, I share Linux tips, setup guides, and personal notes I’ve written for future reference. I hope others find them helpful as well. The content is available in multiple languages.

Browse my gallery for some of my photography.

Away from the keyboard, you’ll find me at concerts, playing clarinet, cycling, scuba diving, or exploring new places, cultures, and cuisines.

Always happy to connect! 🙂

comments powered by Disqus