Skip to content

DevonLian/PYCASTER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PYCASTER : An Open Source Chromecast alternative !

PYCASTER is a casting application for your Raspberry Pi. It creates an HTTP server on your Pi that will stream videos for you and output it on an external monitor. Plug your Pi to your TV/Screen, connect to your Pi through your browser, and stream !

PYCASTER uses omxplayer for optimal performances (hardware-acceleration) and youtube-dl to generate a stream that is piped into omxplayer. No data will be stored on your Pi, unless you want to. Youtube-dl allows access to a wide range of websites : PYCASTER will support all youtube-dl supported websites. See : Youtube-dl list of supported sites

INSTALL PYCASTER

Download the setup.sh file and run it (on your Pi) :

wget https://raw.githubusercontent.com/DevonLian/PYCASTER/master/setup.sh
chmod +x setup.sh
./setup.sh

Or git clone the repo and run the setup

git clone https://github.com/DevonLian/PYCASTER.git
chmod +x setup.sh
./setup.sh

PYCASTER's code is really simple and will run on almost any distro. Please note that if you have already installed youtube-dl on your Pi PYCASTER will delete it and install the latest version from the official repo.

WHAT TO EXPECT TO BE INSTALLED...

python-dev python-pip nodejs npm youtube-dl lame mpg321

#Controlling your PYCASTER

START / STOP

Using the scripts :

pycaster.sh start
pycaster.sh stop

Manually :

node /path-to/PYCASTER/server.js

OR

forever start /path-to/PYCASTER/server.js
forever
ensures that your script runs continuously

STREAMING

Everything can be done in a web browser:

Connect to your Pi in your Web Browser using its ip :

http://pi-ip:8080/

Stream YouTube Video: Just click on

"Stream Youtube"
and Copy/Paste the video URL

Close currently played video : Click on

"Kill"

Stream any Youtube-dl supported website : Click on

"Stream non-youtube"
and Copy/Paste the video URL.

Tip : To bypass unsupported youtube-dl hint, you'll need to find the direct stream URL, and pass it to PYCASTER. Here's how to do it : Isolate Stream Url through Chromium/Chrome

If the video doesnt start within 10 seconds, it's probably because it is'nt supported by youtube-dl. Try to launch youtube-dl directly on the url you're trying to stream to see debugging information (youtube-dl $url)

More to come !

I WANT MORE COMMANDS!

PYCASTER build is pretty simple, here's how to add new commands : 1). Edit index.html : Add a new button :

\\\

Create a message linked to that button :

$\('\#BUTTON_ID'\).click\(function \(\) \{
		var url = prompt\('Url to Stream :'\);  //Sample Code
		socket.emit\('url', url\);              //Ask for a prompt and sends its results to the server
    \}\)

2). Edit server.js

Create a function that is called when your button sent the user input, and put it next to the others

socket.on\('url', function\(url_read\) \{
      	socket\.url = url\_read;
	exec\("omxplayer  \-o hdmi $\(youtube\-dl \-g \-f mp4 '" \+ socket\.url \+ "') &"\);
	\}\);

About

I had a Pi, I had a TV, I had a PC. And I was too lazy too get up and plug my pc to the TV through HDMI. So I plugged the Pi to the TV, and started looking for a screen casting software.

I stumbled upon Lance Seidman's PiCast but had issues with the install and its use of livestream. So I first customized a bit PiCast Code, and I finally ended doing major changes. However, the install script and the general conception is the same. So, props to him !

That's how PYCASTER is born.

How does it works ? It relies upon Node JS to create a lightweight server on the PI. You connect to the Pi, the server-side JavaScripts delivers a simple webpage (index.html). The communication is done in real time thanks to the socket.io library. Your browser connects to the Pi, you send the URL you want to stream, and the Pi streams it for you through omxplayer and youtube-dl.

Contact

Reddit : reddit.com/u/DevonLian Twitter : @devon_lian

Feel free to ping me !

About

PYCASTER lets you cast and stream videos froms various websites. Chromecast-like.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published