abcdeeeeff
Posts: 11
Joined: Wed Nov 28, 2012 10:24 am

[GUIDE] Chromecast streaming from raspberry pi

Sun Mar 30, 2014 7:48 pm

In this guide I'm explaining how to stream your movies, music and photos from your raspberry pi to your chromecast. If your media are not encoded in a chromecast-compatible format(see here https://developers.google.com/cast/docs/media), bubbleupnp server will transcode them.
Be aware that the pi is not powerful enough for on-the-fly video transcoding. So if your videos are not encoded in x264, you have to convert them, or to setup bubbleupnp server on a more powerful PC.

Prerequisites
- a Raspberry Pi(with raspbian)
- a Chromecast
- an Android device to control playback(probably you can find other programs to do that, but I know none)

Server setup
To make media available to your chromecast you need a DLNA/UPnP server. The best I've found so far is minidlna, which is very lightweight, and has all the functions we need(even if the version in the repo is very old). There's plenty of guide on installing and configure it, just search in the forum.

Since the chromecast only support a limited number of codecs(see the complete list here: https://developers.google.com/cast/docs/media), we need to also install bubbleupnp server, which transcodes the media to a compatible format. Bubbleupnpserver is needed also if you use subtitles(both external or embedded in the video file).
Create the directory where you want to install it, then:

Code: Select all

wget http://www.bubblesoftapps.com/bubbleupnpserver/0.8.2/BubbleUPnPServer-0.8.2.zip -O bubbleupnpserver.zip
unzip bubbleupnpserver.zip
chmod +x launch.sh
To launch the server just

Code: Select all

sudo ./launch.sh
if you don't want to see text output, just use

Code: Select all

sudo ./launch.sh > /dev/null 2>&1 &
Now you only have to make the server start at boot.

Code: Select all

sudo nano /etc/init.d/BubbleUPnPServer
Paste in the file the following text

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="/var/www/bubbleupnp"

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
in the line

Code: Select all

DAEMON_PATH="/var/www/bubbleupnp"
you should change /var/www/bubbleupnp to the folder where you extracted the server. Then

Code: Select all

sudo chmod 755 /etc/init.d/BubbleUPnPServer
sudo update-rc.d BubbleUPnPServer defaults
how to compile ffmpeg
If your videos have embedded subtitles, or have audio encoded in a format not supported by the chromecast, you must use ffmpeg.
The version in raspbian repository is way too old, so you have to compile it all by yourself.
The next part of the guide is mainly taken from this page of the official wiki: http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide.

First you have to install all the dependecies:

Code: Select all

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get -y install autoconf automake build-essential libass-dev libgpac-dev libtool pkg-config texi2html zlib1g-dev libmp3lame-dev libx264-dev
Then create a directory to hold sources

Code: Select all

mkdir ~/ffmpeg_sources
Download and compile libfdk-aac(aac decoder and encoder). This will take roughly 10 minutes.

Code: Select all

cd ~/ffmpeg_sources
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
unzip fdk-aac.zip
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
sudo make
sudo make install
Download and compile ffmpeg. This will take roughly 3 hours.

Code: Select all

cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
export PKG_CONFIG_PATH
./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" \
   --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl \
   --enable-libass --enable-libfdk-aac --enable-libmp3lame --disable-ffserver --disable-ffplay\
   --enable-libx264 --enable-nonfree 
sudo make
sudo make install
At this point you should find ffmpeg and ffprobe in ~/bin. Just copy those in bubbleupnp server folder and restart the server.

Stream your files
Install bubbleupnp on your android device(https://play.google.com/store/apps/deta ... bubbleupnp).
Open the app and go to the "devices" tab. It is dived into two parts: "Renderes", where you have to select your chromecast, and "Libraries", where you have to select your minidlna library.
Then just go to "Library" and select the media you want to play, and you'll see it appearing on your screen!
Last edited by abcdeeeeff on Sat Apr 05, 2014 4:26 pm, edited 3 times in total.

yorkshire_geek
Posts: 1
Joined: Mon Mar 31, 2014 4:15 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Mon Mar 31, 2014 4:18 am

Line which mentions libmp3lame should be libmp3lame-dev

abcdeeeeff
Posts: 11
Joined: Wed Nov 28, 2012 10:24 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Mon Mar 31, 2014 7:17 am

Thanks, now it's corrected

peewee2
Posts: 57
Joined: Sun Apr 14, 2013 7:04 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Mon Mar 31, 2014 10:18 pm

I hate to rain on your parade, but why - apart from the "fun" of doing it, would I want to send data from a rpi to chromecast when I can install Xbmc and do pretty much everything chromecast can do and much more without telling Google all about my viewing habits.

I also don't need to waste time converting to h264, as Xbmc handles most formats direct.

Pete

abcdeeeeff
Posts: 11
Joined: Wed Nov 28, 2012 10:24 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Sat Apr 05, 2014 4:56 pm

peewee2 wrote:I hate to rain on your parade, but why - apart from the "fun" of doing it, would I want to send data from a rpi to chromecast when I can install Xbmc and do pretty much everything chromecast can do and much more without telling Google all about my viewing habits.

I also don't need to waste time converting to h264, as Xbmc handles most formats direct.

Pete
For these reasons:
- I have some servers running on my pi, so it must always be connected to my local network. But it doesn't like my wifi dongle very much(it disconnects after a while). I've already tried all the possible solutions(usb powered hub and so on) and I don't want to buy another dongle. So i must keep it connected to my router with and ethernet cable.
- One of the servers is a samba server, which shares an HD connected to my pi. So everytime I want to use raspbmc I have a raspberry pi, a (powered)usb hub and a hard disk lying around the tv. This is quite horrible to see. The chromecast is behind the tv and I don't even see it.
- My raspberry pi is one of the old model B with 256 MB of ram, so raspbmc is a little laggy(even with overclock and usb install). A fast way to play my media is to use yatse, but my pi disconnects from wifi very often, so it's unusable. And I don't really use any of xbmc features.
- All my videos are already x264, so that's not a problem.

rsdenkovich
Posts: 1
Joined: Wed Apr 09, 2014 3:31 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Wed Apr 09, 2014 3:35 pm

Hi, can you provide some details how minidlna and bubbleupnp works together on pi? Both performance and relation between these two? Thanks!

superzanti
Posts: 1
Joined: Wed Jul 16, 2014 9:52 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Wed Jul 16, 2014 10:24 pm

Does anybody have an image they could post for doing this?

Also how well does it perform? Especially for non-h264 formats?

erikholtan
Posts: 2
Joined: Sun Aug 18, 2013 8:22 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Sat Aug 09, 2014 12:57 am

For those looking for a way to not compile for hours, I have done it and provided the binaries.

https://dl.dropboxusercontent.com/u/8507526/ffprobe
https://dl.dropboxusercontent.com/u/8507526/ffmpeg

edmun
Posts: 39
Joined: Thu Jan 09, 2014 11:37 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Mon Oct 13, 2014 10:51 pm

I would like to say a big thank you to the author of this topic. So - big Thank you to abcdeeeeff


Without this thread, I wouldn't buy Chromecast and try to use minidlna and BubbleUPNP server.

Background:
I do have a lot of hard drives and I do have them connected to my Raspberry Pi and shared in the network with the use of NAS Samba.
But sadly, I do not have DLNA/Smart TV. I only do have a 32" Samsung with HDMI and USB ports.
I could unplug the drives from Raspberry and connect them directly to tv, but it's not a solution for me :)
Finally I have decided to buy Chromecast.
It did not take me long, to understand what I need to do and after 2-3 hours of intense reading, I have managed to:

a) install Chromecast
b) install minidlna and add library entries
c) install Bubble UPNP server (0.8.2) and afterwards install newer version (0.8.3) on the Raspberry Pi
d) install Bubble UPNP application on Android phone and even buy a license straight away

Ok.. as for the summary here:
I do not have to start my PC to watch a movie and I do not have to unplug any hard drives or any peripherals to watch something on my tv. Bubble UPNP works great and yes - I also do have a lot of files in H.264 already (let's be honest - thousands of mkv files). I am not 100% sure if I really need all this ffmpeg and ffprob,

I have checked the FAQ of Bubble:
http://bubblesoftapps.com/bubbleupnpserver/ wrote: ffmpeg/ffprobe

A working ffmpeg binary is required. The ffmpeg version must not be too old (at least v1.0) and the more up to date it is, the better.

A working ffprobe binary is optional. If a local ffprobe binary is not found, ffprobe will be called from the cloud, requiring that BubbleUPnP Server is passing the connectivity test succesfully.

ffmpeg/ffprobe binaries located in the installation directory are used if present, otherwise they are searched in the PATH
On Ubuntu, the PPA package will download the required ffmpeg/ffprobe binaries so it should work out of the box
On other Linux distributions, unzip these binaries in the installation directory
On MacOS X, download binaries from this site and put them the installation directory

On the Raspberry Pi (powerful enough only for audio), the ffmpeg/ffprobe version might be too old and you must replace them by more recent binaries. This ffmpeg compilation guide may be useful
On other platforms you can try using Google for finding suitable ffmpeg/ffprobe binaries
So if my understanding is correct - this means that from other files then mp4/mkv (in h.264) I would be only able to transmit video with encoded different audio tracks and switch between them?

What is my only concern with this setup is the subtitles issues.
I don't know - probably I am missing something and now I am looking for some help.
Maybe someone will point me into the correct direction.

Minidlna is providing DLNA functionality (streamer?), Bubble UPNP server is the actual UPNP server to send anything to Chromecast, and this Chromecast is a receiver (hardware player/video transferrer to the TV). In a very basic words I think that's the best description of the setup. Of course in the middle we do have Bubble UPNP on the Android phone which is a controller.

But going back to subtitles.
I don't understand why those are not being catched/shown automatically.
I am downloading them in ANSI format (Windows 1250 / Windows 1252 and so on?). Extension is set to srt.
(and I have already tried with converting them into UTF-8). The name of the srt file with subtitles is the same as the movie file.

The only workaround I have found, to see subtitles on the tv screen, is to select a movie from Raspberrys Minidlna on my phone, play it to chromecast, await couple of seconds until the "subtitles" icon will appear, click it and select "Add subtitles". I am choosing my file manager and open network location of a shared drive (where the movie is kept) and I need to manually select srt file. Subtitles afterwards are being shown on the tv screen.

So for sure Chromecast is capable to "show" those subtitles on the screen. Therefore I would understand that BubbleUPNP server is capable of sending it to Chromecast. So where is the issue? Why I need to manually add the file into Bubble? Is it because Minidlna is not sending them?
I am urgently looking for some answers.
Can anyone help me with this one?

edmun
Posts: 39
Joined: Thu Jan 09, 2014 11:37 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Thu Oct 16, 2014 12:57 am

abcdeeeeff wrote: At this point you should find ffmpeg and ffprobe in ~/bin. Just copy those in bubbleupnp server folder and restart the server.

Hi. Could you please help me out.?
I've done I think everything. Compiled sound, waited half a day (my raspberry pi was overloaded) for make to finish and finally once it finished, after another half a day I had to say "enough".
I have copied ffmpeg and ffprobe (executables) to mine /var/www/bubbleupnp folder. No matter how many times I am trying, on my android phone there is an information that ffmpeg has not been installed.
Could you please point me what I have missed?


MaccioVikingo
Posts: 1
Joined: Fri Oct 31, 2014 12:27 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Fri Oct 31, 2014 12:32 pm

Hi, can I use this guide to set BubbleUPnP also on OpenELEC?

rjbailey95066
Posts: 9
Joined: Wed Dec 24, 2014 3:49 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Wed Dec 24, 2014 2:27 pm

Thank you erikholtan! I've been struggling for days with this. I'm unable to recompile ffmpeg, ffserver, and ffprobe with support for the RPi integrated GPU. None of the guides I've found provide enough detail. I figured the magic is in the ./configure options. How did you do it?
erikholtan wrote:For those looking for a way to not compile for hours, I have done it and provided the binaries.

https://dl.dropboxusercontent.com/u/8507526/ffprobe
https://dl.dropboxusercontent.com/u/8507526/ffmpeg

lamero
Posts: 6
Joined: Tue Dec 03, 2013 9:38 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Sat Jan 10, 2015 11:05 am

Done. But very slow. Not usable for me

ElusiveZatchmo
Posts: 1
Joined: Thu Mar 26, 2015 1:59 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Thu Mar 26, 2015 2:03 am

I followed the instructions, I even tried the pre-compiled binaries that someone was nice enough to post and all I'm getting is the error "ffmpeg does not support H264". What am I missing?

samo
Posts: 1
Joined: Fri Jun 05, 2015 9:16 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Fri Jun 05, 2015 9:35 pm

When I start the launch.sh script manually everything works fine but when I try to use the init script it doesn't work.

When I start the init script I get the following output:

Code: Select all

sudo /etc/init.d/bubbleupnp_server start
Starting bubbleupnp_server...                     Okn
But when I check the status I get following output:

Code: Select all

sudo /etc/init.d/bubbleupnp_server status
Checking bubbleupnp_server...                     Process dead but pidfile existsn

etienne65
Posts: 1
Joined: Sat Oct 31, 2015 1:29 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Sat Oct 31, 2015 1:34 am

Hello,
Thank for your tutorial,
I have a problem,
I've succed installed the server
i can run it on my browser http://localhost:58050
But i don't know where i need to put my movies.
Indeed when i launch BubbleUPnP on my android tabblet there isn't film in the folder

Can you help me please

edmun
Posts: 39
Joined: Thu Jan 09, 2014 11:37 am

Re: [GUIDE] Chromecast streaming from raspberry pi

Tue Nov 17, 2015 3:04 pm

abcdeeeeff wrote:In this guide I'm explaining how to stream your movies, music and photos from your raspberry pi to your chromecast. If your media are not encoded in a chromecast-compatible format(see here https://developers.google.com/cast/docs/media), bubbleupnp server will transcode them.
Be aware that the pi is not powerful enough for on-the-fly video transcoding. So if your videos are not encoded in x264, you have to convert them, or to setup bubbleupnp server on a more powerful PC.

Hi Guys

Recently I was asked by one of the members of the forum, if I can help him out to setup minidlna with BubbleUPNP server on Android device. I don't know if it's used with or without Chromecast, however my private message was quite long, apperantly it has helped the other person and I was asked if I could share it also on a forum, so if anyone would be struggling to get this working, he may also look into the guide below.
All the credits still goes to abcdeeeeff which has created this topic and created the guide.
My version is just an alternative way into looking into same thing:

Ok. Let's start with some basic checks :)

I have updated my raspberry pi repositories/updates list by running

Code: Select all

sudo apt-get update
and also by running the:

Code: Select all

sudo apt-get upgrade
next, I have installed minidlna by running:

Code: Select all

sudo apt-get install minidlna
Next, I have opened the configuration file by running:

Code: Select all

sudo nano /etc/minidlna.conf
I have added couple of my folders to be listed in the minidlna.
Please see my configuration file below:

Code: Select all

# This is the configuration file for the MiniDLNA daemon, a DLNA/UPnP-AV media
# server.
#
# Unless otherwise noted, the commented out options show their default value.
#
# On Debian, you can also refer to the minidlna.conf(5) man page for
# documentation about this file.


# Path to the directory you want scanned for media files.
#
# This option can be specified more than once if you want multiple directories
# scanned.
#
# If you want to restrict a media_dir to a specific content type, you can
# prepend the directory name with a letter representing the type (A, P or V),
# followed by a comma, as so:
#   * "A" for audio    (eg. media_dir=A,/var/lib/minidlna/music)
#   * "P" for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
#   * "V" for video    (eg. media_dir=V,/var/lib/minidlna/videos)
#
# WARNING: After changing this option, you need to rebuild the database. Either
#          run minidlna with the '-R' option, or delete the 'files.db' file
#          from the db_dir directory (see below).
#          On Debian, you can run, as root, 'service minidlna force-reload' instead.
media_dir=V,/media/Intenso/Filmy_HD
media_dir=V,/media/Intenso/Filmy
media_dir=V,/media/Intenso/Filmy_przyrodnicze
media_dir=V,/media/Archive/Filmy_DVD
media_dir=V,/media/Archive/Filmy_Polskie_Komedie
media_dir=V,/media/Archive/Filmy_obejrzane
media_dir=V,/media/Archive/Koncerty
media_dir=V,/media/Intenso/Deluge/completed
media_dir=V,/media/Intenso/Filmy_bez_napisow


# Path to the directory that should hold the database and album art cache.
db_dir=/var/lib/minidlna

# Path to the directory that should hold the log file.
log_dir=/var/log

# Minimum level of importance of messages to be logged.
# Must be one of "off", "fatal", "error", "warn", "info" or "debug".
# "off" turns of logging entirely, "fatal" is the highest level of importance
# and "debug" the lowest.
log_level=warn

# Use a different container as the root of the directory tree presented to
# clients. The possible values are:
#   * "." - standard container
#   * "B" - "Browse Directory"
#   * "M" - "Music"
#   * "P" - "Pictures"
#   * "V" - "Video"
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root
#root_container=.

# Network interface(s) to bind to (e.g. eth0), comma delimited.
#network_interface=
# IPv4 address to listen on (e.g. 192.0.2.1).
#listening_ip=

# Port number for HTTP traffic (descriptions, SOAP, media transfer).
port=8200

# URL presented to clients.
# The default is the IP address of the server on port 80.
#presentation_url=http://example.com:80

# Name that the DLNA server presents to clients.
friendly_name=RaspberryPi

# Serial number the server reports to clients.
serial=12345678

# Model name the server reports to clients.
#model_name=Windows Media Connect compatible (MiniDLNA)

# Model number the server reports to clients.
model_number=1

# Automatic discovery of new files in the media_dir directory.
inotify=yes

# List of file names to look for when searching for album art. Names should be
# delimited with a forward slash ("/").
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg

# Strictly adhere to DLNA standards.
# This allows server-side downscaling of very large JPEG images, which may
# decrease JPEG serving performance on (at least) Sony DLNA products.
#strict_dlna=no

# Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.
#enable_tivo=no

# Notify interval, in seconds.
#notify_interval=895

# Path to the MiniSSDPd socket, for MiniSSDPd support.
#minissdpdsocket=/run/minissdpd.sock
Of course, for different types of files, you have to set different media entries.

Once done, I have added minidlna to the startup by running:

Code: Select all

sudo update-rc.d minidlna defaults
and next started the minidlna by running:
sudo service minidlna start
Please check if the service is up and running by typing:
sudo service --status-all
You should find "+" symbol next to the minidlna.
Do you have any PCs on the network with for example Windows 7?
Go to "Network" and check if you can see an icon which looks like MediaPlayer with your Raspberry Pi name.
If yes - that's great = minidla works.
Image
Next thing I had to do, was to install BubbleUPNP server:

I have followed the topic on the forum and done as following:

Code: Select all

wget http://www.bubblesoftapps.com/bubbleupnpserver/0.8.3/BubbleUPnPServer-0.8.3.zip -O bubbleupnpserver.zip

Code: Select all

unzip bubbleupnpserver.zip

Code: Select all

chmod +x launch.sh

Code: Select all

sudo ./launch.sh > /dev/null 2>&1 &
next, added BubbleUPNP server to the autostart by creating new file:

Code: Select all

sudo nano /etc/init.d/BubbleUPnPServer
copy and paste the code into the newly created file (in putty ssh terminal just right click to paste)

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="/var/www/bubbleupnp"

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 as per in the topic:
in the line

DAEMON_PATH="/var/www/bubbleupnp"
you should change /var/www/bubbleupnp to the folder where you, have extracted the server

Then
let's add some permissions

Code: Select all

sudo chmod 755 /etc/init.d/BubbleUPnPServer
and add the script to the autostart/startup

Code: Select all

sudo update-rc.d BubbleUPnPServer defaults
Next,reboot the raspberry by running

Code: Select all

sudo reboot
check services again by running

Code: Select all

sudo service --status-all
Next to BubbleUPNP server you should have a "+" symbol
Image
I have installed Bubble UPNP on my android phone, bought license after some time.
On the phone:
I do open BubbleUPNP, I go to settings and adding the server by the "Setup network wizard".
Image
Image
Of course, on the first screen I go with NEXT
Image
and on the main page I do add as following:
Server address: ip_of_my_raspberrypi:58050
login: my_login
password: my_password
Image
Please note that depending on the type of your network, you will change the bottom setting "Active on connection" to fit your requirements. For example: I do have an external IP address with IP port forwarding so if I am away from home, I will connect to my DNS name like "http://raspberrypidns.org:58050" however my stupid router does not support some internal forwarding which means that when I am at home, I am unable to reach this address and I have to use local ip addresses instead. So finally: when I am at home, I do have a server "http://192.168.0.8:58050" set to be "Active" only on Wifi, and I have added my external address "http://raspberrypidns.org:58050" to work only on 3G/LTE connection. For most users, setting this to all networks is the best option.

I do always click TEST to see if everything works.
If there is no connection and you are absolutely sure that you are on the same network within the same IP range,
I would check if you do have port forwarding set up correctly on your router.

While I will do everything ok, I can see that in LIBRARY in Local Media Server I do have my Raspberry Pi server.
Image
Chromecast will appear automatically in RENDERER section if connected to the same Wifi (note: you may have to install "BubbleUPNP Chromecast Plugin" on your android device), however I have found plenty of times that something goes wrong and Chromecast isn't there. If this keeps happening, I do restart Chromecast by unplugging it from power and I do reboot my phone/tablet.

HughFranklin
Posts: 5
Joined: Thu Nov 26, 2015 5:00 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Fri Nov 27, 2015 12:59 pm

Great guide. I used some of this in my labours to get BubbleUPnP running under OSMC rather than Rasbian as I wanted to transcode to my Chromecast but I also wanted a media centre running Kobi.

See viewtopic.php?f=36&t=102021&p=850717&hi ... er#p850717

User avatar
robotijin
Posts: 10
Joined: Wed Jan 06, 2016 10:50 am
Contact: Website

Re: [GUIDE] Chromecast streaming from raspberry pi

Fri Jan 08, 2016 2:25 pm

Thank you edmun.

Also I had to install Java.
Twitter @raspberryano | Blog http://enredandoconlaraspberry.blogspot.com

colmheaney
Posts: 1
Joined: Tue Jan 19, 2016 8:38 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Tue Jan 19, 2016 8:41 pm

Thanks for this, it worked great for me except I had to add the following to the init.d script to get BubbleUPnPServer to autostart:

export PATH=.:${PATH}

and change

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

to

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

Thanks

Variaxocellus
Posts: 1
Joined: Thu Jan 12, 2017 11:21 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Thu Jan 12, 2017 11:27 pm

Everythig was going great until I arriver to this command:

Code: Select all

 sudo update-rc.d BubbleUPnPServer defaults
Then this error showed up:
insserv: Script BubbleUPnPServer is broken: incomplete LSB comment.
insserv: missing `Provides:' entry: please add.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `BubbleUPnPServer'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `BubbleUPnPServer'
But this seems correct to me:

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
Help please?

henryjfry
Posts: 10
Joined: Thu Dec 29, 2016 1:24 pm

Re: [GUIDE] Chromecast streaming from raspberry pi

Sat May 13, 2017 2:55 pm

Hey

I got this working on my pi running osmc using the following guide:

viewtopic.php?f=36&t=102021

And transcoding to chromecast works.

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.

Return to “Graphics, sound and multimedia”

Who is online

Users browsing this forum: No registered users and 12 guests