BubbleUPnP for transcoding


12 posts
by WaPeR » Fri Feb 27, 2015 1:00 pm
Hi!

I'm looking for a way to transcode videos from a Raspberry Pi 2 to a Chromecast and I found 2 ways: Plex and BubbleUPnP.
I read in Plex forums that Plex in working very nice but the transcoding is weak and laggy. But, what about the second option? Did you try it?

Thanks!

PD: I'm not an owner of a RPI2, I'm still waiting for it to purchase one (no stock in Spain)
User avatar
Posts: 4
Joined: Fri Feb 27, 2015 12:47 pm
by default_user8 » Fri Feb 27, 2015 6:01 pm
This post has some info on installing the bubbleupnp server on a raspi.
http://blog.scphillips.com/2013/07/play ... revisited/
Two heads are better than one, unless one's a goat head.
User avatar
Posts: 500
Joined: Mon Nov 18, 2013 3:11 am
by WaPeR » Fri Feb 27, 2015 7:23 pm
default_user8 wrote:This post has some info on installing the bubbleupnp server on a raspi.
http://blog.scphillips.com/2013/07/play ... revisited/


But I want to know if you tried to install it on a RPi2 and how it works transcoding (audio only I think because I only want to transcode AC3 codec to another the Chromecast can handle)

Thanks!
User avatar
Posts: 4
Joined: Fri Feb 27, 2015 12:47 pm
by elParaguayo » Sat Feb 28, 2015 5:08 am
Why don't you try it for yourself and then share your own experiences?
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.
User avatar
Posts: 1793
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK
by WaPeR » Sat Feb 28, 2015 10:19 am
elParaguayo wrote:Why don't you try it for yourself and then share your own experiences?


Because I want to know that to purchase the RPi2, if it can't make the transcoding process then I don't need it, at least by now. That's why I'm looking for another experiences.

Thanks for your answers.
User avatar
Posts: 4
Joined: Fri Feb 27, 2015 12:47 pm
by WaPeR » Tue Mar 10, 2015 7:25 pm
Did anybody use BubbleUPnP for this purpose?

Thanks!
User avatar
Posts: 4
Joined: Fri Feb 27, 2015 12:47 pm
by HughFranklin » Thu Nov 26, 2015 5:39 pm
I have just purchased a Raspberry Pi 2. Previously I got BubbleUPnP Server running on a Raspberry Pi B using the helpful guide referenced above http://blog.scphillips.com/posts/2013/07/playing-music-on-a-raspberry-pi-using-upnp-and-dlna-revisited/#comment-1252232685. I managed to get this running at the time under RaspBMC and it was a good solution (and also great fun relearning my Unix skills :) ).

So I thought I'd do the same with my new Pi BUT this is an Arm 7 architecture (not Arm 6) and RaspBMC has become OSMC...

A new challenge.

So far I've done the following:

1. Install OSMC through NOOBS
2. Install BubbleUPnP Server as per the above referenced guide = Problem 1 - Java libraries missing under OSMC
3. Installed Java using:
Code: Select all
sudo apt-get install default-jre

4. Started BubbleUPnP Server = Problem 2 - Can't find ffmpeg for transcoding audio and video
5. Turns ffmpeg is now deprecated so not available through apt-get = Problem 3 - Need to build ffmpeg
6. Obtained ffmpeg source using guidance from http://www.jeffreythompson.org/blog/2014/11/13/installing-ffmpeg-for-raspberry-pi/:
Code: Select all
cd /usr/src
sudo git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-nonfree
sudo make
sudo make install
= Problem 4 - no git command in OSMC
7. Installed git using:
Code: Select all
sudo apt-get install git-core

8. Tried to build again = Problem 5 - no gcc compiler in OSMC
9. Installed gcc using
Code: Select all
sudo apt-get install build-essential

10: Tried to build again (as in Step 6 above) - and it's working :P :P :P

So that's as far as I've got - I'm expecting the build to take some times - I see references to 3 hours on a Pi B+ so hoping for 30 minutes or so on the Pi 2.

I'll post back here with an update later this week.
Posts: 5
Joined: Thu Nov 26, 2015 5:00 pm
by HughFranklin » Fri Nov 27, 2015 12:52 pm
Well the story continues...

Building FFMPEG on the Pi 2 took about 90 minutes. I then restarted the BubbleUPnp Server - and Problem 6 - I hadn't enabled the LameMp3 option, I did so using:
Code: Select all
sudo ./configure --enable-gpl --enable-libmp3lame --enable-nonfree
But Problem 7 LameMP3 also wasn't installed. So following the guide at https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu I performed the following:
Code: Select all
sudo apt-get install nasm
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
sudo ./configure --enable-nasm --disable-shared
sudo make
sudo make install
sudo make distclean
NB: I changed some options to make Lame build in a place that my installation of FFMPEG (as per above) will see it.

And then I was faced with another 90 minutes wait whilst I rebuilt FFMPEG again this time enabling Lame:
Code: Select all
sudo ./configure --enable-gpl --enable-libmp3lame --enable-nonfree
sudo make
sudo make install
However, once this was performed restarting BubbleUPnP shows audio transcoding should now work 8-).

Video transcoding won't but this can be fixed by repeating the steps above to also enable libx264, however, I haven't bothered with this as I doubt the Pi 2 can handle video transcoding on the fly (a test for another day maybe) - and I don't want to rebuild FFMPEG again (should have done the two together in the first place ;) ).

[Actually I'm no Unix expert so perhaps it's not necessary to keep rebuilding like this - maybe just reassemble (anybody out there help me here?)].

Anyway I'm now going to test this setup on my Chromecast to see whether I can playback my WMA audio collection through the Google toy with the Pi 2 transcoding the audio on the fly through BubbleUPnP Server - I'll let you know how I get on.

[POST-EDIT] It works fine and dandy on the Chromecast :P It works find and dandy away from my home network :P :P
Last edited by HughFranklin on Sun Feb 28, 2016 7:26 pm, edited 1 time in total.
Posts: 5
Joined: Thu Nov 26, 2015 5:00 pm
by HughFranklin » Sun Feb 28, 2016 7:21 pm
So I had to rebuild (OSMC went funny :( and I lost the ability to use my TV remote, only fix I could find was to rebuild OSMC from scratch - lucky I had that Backup :) ) and this was my reference to adding BubbleUPnP Server back into my mix but I've realised that it's a bit all over the place and therefore pretty hard to follow.

So this is a summary of how to get BubbleUPnP Server running with OSMC on a Raspberry Pi 2.

1 Install Java:
Code: Select all
sudo apt-get install default-jre
2 Install git (NB: on the second pass I didn't need as I'd installed Retrosmc):
Code: Select all
sudo apt-get install git-core
3 Install gcc (NB: on the second pass I didn't need as I'd installed Retrosmc):
Code: Select all
sudo apt-get install build-essential
4 Install and build lame:
Code: Select all
cd /usr/src
sudo apt-get install nasm
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
sudo ./configure --enable-nasm --disable-shared
sudo make
sudo make install
sudo make distclean
5 Install and build ffmpeg (this includes audio and video transcoding libraries and takes up to 90 minutes):
Code: Select all
cd /usr/src
sudo git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
sudo ./configure --enable-gpl --enable-libmp3lame --enable-libx264 --enable-nonfree
sudo make
sudo make install
6 Get BubbleUPnP Server:
Code: Select all
cd /tmp
wget http://www.bubblesoftapps.com/bubbleupnpserver/BubbleUPnPServer-distrib.zip
cd /usr/local/bin
sudo mkdir BubbleUPnPServer
cd BubbleUPnPServer
sudo unzip /tmp/BubbleUPnPServer-distrib.zip
7 Make BubbleUPnP Server executeable:
Code: Select all
sudo chmod +x launch.sh
8 Create Init.D Script:
Code: Select all
sudo nano /etc/init.d/BubbleUPnPServer
and add this code:
Code: Select all
#!/bin/bash
### BEGIN INIT INFO
# Provides:          BubbleServer
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: BubbleUPnP Server Background Service Management
# Description:       Used to ensure BubbleUPnP starts/stops etc
### END INIT INFO

DAEMON_PATH="/usr/local/bin/BubbleUPnPServer"

DAEMON="java -Xss256k -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -jar BubbleUPnPServer.jar"
DAEMONOPTS=""

NAME=BubbleUPnPServer
DESC="Runs BubbleUPnPServer"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

case "$1" in
start)
  printf "%-50s" "Starting $NAME..."
  cd $DAEMON_PATH
  PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
  #echo "Saving PID" $PID " to " $PIDFILE
        if [ -z $PID ]; then
            printf "%sn" "Fail"
        else
            echo $PID > $PIDFILE
            printf "%sn" "Ok"
        fi
;;
status)
        printf "%-50s" "Checking $NAME..."
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
                printf "%sn" "Process dead but pidfile exists"
            else
                echo "Running"
            fi
        else
            printf "%sn" "Service not running"
        fi
;;
stop)
        printf "%-50s" "Stopping $NAME"
            PID=`cat $PIDFILE`
            cd $DAEMON_PATH
        if [ -f $PIDFILE ]; then
            kill -HUP $PID
            printf "%sn" "Ok"
            rm -f $PIDFILE
        else
            printf "%sn" "pidfile not found"
        fi
;;

restart)
    $0 stop
    $0 start
;;

*)
        echo "Usage: $0 {status|start|stop|restart}"
        exit 1
esac
and save it (Ctrl-O, Ctrl-X).

9. Make executeable and add to rc.d:
Code: Select all
sudo chmod 755 /etc/init.d/BubbleUPnPServer
sudo update-rc.d BubbleUPnPServer defaults

Reboot OSMC!

;)
Posts: 5
Joined: Thu Nov 26, 2015 5:00 pm
by Breedtman » Wed May 11, 2016 7:45 pm
can't believe it's really working.

Autostart will not work with OSMC, cause that bypasses the init.d but uses system instead. So how did you manage to get autostart working?
I always have to use my windows laptop to start SSH and start Bubble. Anoying, cause I baught the Raspberry so i would not have to use my windows laptop. I also don't see a possibility to use SSH in OSMC.
For mor then a week now, I'm trying to get this Rasp Pi 3 to work as a standalone mediaserver, wich I can control with bubble on my android phone. I suppose it's not gonna work...

But thanks for your tuto. Learned a lot about Linux (i'm totaly windows guy)
Posts: 1
Joined: Wed May 11, 2016 2:25 pm
by thomas_d_j » Tue Nov 08, 2016 7:22 am
@HughFranklin thanks for the detailed instructions.

HughFranklin wrote: 1 Install Java:


Should be able to get by with just the headless version:
Code: Select all
sudo apt-get install default-jre-headless


Also I had to install a couple of other packages:
Code: Select all
sudo apt-get install pkg-config libx264-142 libx264-dev


Edit: also to get transcoding working I had to create two files:
/usr/local/bin/BubbleUPnPServer/ffmpeg:
Code: Select all
#!/bin/sh
/usr/local/bin/ffmpeg $*


/usr/local/bin/BubbleUPnPServer/ffprobe:
Code: Select all
#!/bin/sh
/usr/local/bin/ffprobe $*


Then make them executable:
Code: Select all
$ sudo chmod +x /usr/local/bin/BubbleUPnPServer/ffmpeg
$ sudo chmod +x /usr/local/bin/BubbleUPnPServer/ffprobe



Breedtman wrote:Autostart will not work with OSMC, cause that bypasses the init.d but uses system instead. So how did you manage to get autostart working?


use systemctl:
Code: Select all
sudo systemctl status bubbleupnpserver.service  # checks status
sudo systemctl start bubbleupnpserver.service  # starts once
sudo systemctl enable bubbleupnpserver.service  # auto-starts on boot
sudo systemctl disable bubbleupnpserver.service  # you get the idea...
Posts: 1
Joined: Sun Nov 06, 2016 11:12 pm
by henryjfry » Sat May 13, 2017 2:48 pm
So i got this running on my pi and found I had to add the following service file before it would work with systemd

Code: Select all
sudo nano /lib/systemd/system/bubbleupnpserver.service

[Unit]
Description=BubbleUPnP Server
Requires=network-online.target
After=network-online.target

[Service]
Type=simple
#Environment=DEFAULTFILE=/etc/default/bubbleupnpserver
Restart=on-failure
#ExecStartPre=/usr/local/bin/BubbleUPnPServer/startService.sh
ExecStart=/usr/local/bin/BubbleUPnPServer/launch.sh ${OPTS}

[Install]
WantedBy=multi-user.target


And it does work to transcode to chromecast (but you may have to pay for it if you want more than 20mins, maybe only if you use the android app as a controller?)

But I wanted to know does anyone know how to force it to transcode to a particular renderer which isnt a chromecast?
i.e are there dlna profiles which can be adjusted if its not automatically detecting an audio format isnt supported?

Normally there are xml files of profiles which determine what files are transcoded.
Posts: 10
Joined: Thu Dec 29, 2016 1:24 pm