lanceseidman / picast Goto Github PK
View Code? Open in Web Editor NEWPiCAST turns your $35 Raspberry Pi in to a Chromecast like Device.
Home Page: https://munchron.com
PiCAST turns your $35 Raspberry Pi in to a Chromecast like Device.
Home Page: https://munchron.com
Hi @lanceseidman,
Congratulations! WE got everything & Setup is almost Done!
I'm going to download missing parts now...
Cloning into 'PiCAST'...
remote: Counting objects: 150, done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 150 (delta 73), reused 145 (delta 68)
Receiving objects: 100% (150/150), 33.04 KiB | 57 KiB/s, done.
Resolving deltas: 100% (73/73), done.
PiCAST' to
/var/www/PiCAST': Directory not emptyDo I have to reverse everything I did and start fresh on raspbian?
Regards
Balaji
If you don't know what CJDNS is....
https://github.com/cjdelisle/cjdns
I am a CJDNS developer and I am intrested in your project. How do I run CJDNS along with PiCAST?
pi@raspberrypi:~ $ sudo netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 24568/cupsd
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 4844/vncserver-x11-
tcp6 0 0 ::1:631 :::* LISTEN 24568/cupsd
tcp6 0 0 :::5900 :::* LISTEN 4844/vncserver-x11-
pi@raspberrypi:~ $ ps aux | grep -i picast
pi 10827 0.7 2.2 125028 43504 ? Ssl 20:36 0:07 /usr/bin/node /usr/local/lib/node_modules/forever/bin/monitor picast.js
pi 18141 160 1.2 106508 24700 ? Rl 20:52 0:01 /usr/bin/node /home/pi/PiCAST/picast.js
pi 18147 150 1.1 105448 21124 ? Rl 20:52 0:01 /usr/bin/node /home/pi/PiCAST/picast.js
pi 18154 0.0 0.0 7480 580 pts/0 S+ 20:52 0:00 grep --color=auto -i picast
pi 20055 0.3 2.8 132760 54024 ? Ssl Aug29 7:42 /usr/bin/node /usr/local/lib/node_modules/forever/bin/monitor picast.js
Successfully used setup.sh to install. Unable to connect until the following were completed:
mkdir /var/run/forever
npm i express
When loading rpi.ip:3000 I receive the "Welcome to PiCAST 3! In the URL, type what you want to do..." message. If i load rpi.ip:3000/yt-stream/ftTOEJfzdq0 I receive message "Streaming YouTube Video..." but, nothing further occurs. No video loads on the RPI
First off I only had to fix two lines to get everything saying that it was installing correctly, however, after starting a modding I couldn't help myself from adding a few more tweeks to the code. I forked your code yesterday and will be making a push latter today to that branch of slight changes made to make the installer a bit more robust; take a look at the following bug report and let me know what I need to change to get the js
and services bits working please.
setup.sh
needed sudo
prepended to allow downloading and latter movement of PiCast Daemon script within /etc/ini.d
write protected directory path<commands...> || echo "Failed trying <commands...> | tee -a ${HOME}/PiCAST/errors.log && exit 1"
export CONCURRENCY_LEVEL=$(($(nproc)+2))
which brought source install time down to just under 2 hours for ffmpeg and x264 support ;-)same as /etc/init.d/picast
file's start
command but without exec
to keep session alive
pi@raspberrypi:~ $ forever start --sourceDir=/home/pi/PiCAST -p /var/run/forever picast.js
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: picast.js
fs.js:436
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory '/var/run/forever/Cmv2.log'
at Object.fs.openSync (fs.js:436:18)
at Object.forever.startDaemon (/usr/local/lib/node_modules/forever/lib/forever.js:460:14)
at /usr/local/lib/node_modules/forever/lib/forever/cli.js:315:15
at /usr/local/lib/node_modules/forever/lib/forever/cli.js:161:5
at /usr/local/lib/node_modules/forever/lib/forever.js:412:11 at Object.oncomplete (fs.js:107:15)
pi@raspberrypi:~ $
same as sh ~/PiCAST/picast_start.sh
script
pi@raspberrypi:~ $ cd /home/pi/PiCAST/
pi@raspberrypi:~/PiCAST $ ls
picast.js picast_start.sh picast_stop.sh
pi@raspberrypi:~/PiCAST $ cat picast_start.sh
echo "Starting PiCAST3..."
forever start picast.js
pi@raspberrypi:~/PiCAST $ forever start picast.js warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: picast.js
pi@raspberrypi:~/PiCAST $ ps aux | grep picast | grep -v grep
pi 21617 0.5 2.6 39596 23340 ? Ssl 09:26 0:02 /usr/bin/nodejs /usr/local/lib/node_modules/forever/bin/monitor picast.js
pi@raspberrypi:~/PiCAST $ sudo netstat -plant | grep 3000 || echo "No port found listening"
No port found listening
should be the same as running /etc/init.d/picast start
command with root privlages
pi@raspberrypi:~/PiCAST $ sudo service picast start
Job for picast.service failed. See 'systemctl status picast.service' and 'journalctl -xn' for details.
pi@raspberrypi:~/PiCAST $ sudo systemctl status -l picast.service
picast.service - (null)
Loaded: loaded (/etc/init.d/picast)
Active: failed (Result: exit-code) since Fri 2016-05-06 09:40:54 PDT; 42s ago
Process: 21776 ExecStart=/etc/init.d/picast start (code=exited, status=255)
May 06 09:40:54 raspberrypi picast[21776]: warn: --minUptime not set. Defaulting to: 1000ms
May 06 09:40:54 raspberrypi picast[21776]: warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
May 06 09:40:54 raspberrypi picast[21776]: info: Forever processing file: picast.js
May 06 09:40:54 raspberrypi picast[21776]: error: Cannot start forever
May 06 09:40:54 raspberrypi picast[21776]: error: script /PiCAST/picast.js does not exist.
May 06 09:40:54 raspberrypi systemd[1]: picast.service: control process exited, code=exited status=255
May 06 09:40:54 raspberrypi systemd[1]: Failed to start (null).
May 06 09:40:54 raspberrypi systemd[1]: Unit picast.service entered failed state.
pi@raspberrypi:~/PiCAST $ journalctl -xn
No journal files were found.
pi@raspberrypi:~/PiCAST $ sudo journalctl -xn | grep -E "PiCAST|picast"
May 06 09:44:55 raspberrypi sudo[21856]: pi : TTY=pts/0 ; PWD=/home/pi/PiCAST ; USER=root ; COMMAND=/bin/journalctl
pi@raspberrypi:~/PiCAST $ ps aux | grep picast | grep -v grep || echo "No process found by that name"
No process found by that name
Here are the specs of my RPi (it is a version 2B or RPiB+2?... it's the one with nearly a gig'o'ram and four cores to process with)
pi@raspberrypi:~/PiCAST $ cat /etc/*-release | grep -vE 'HOME_URL|SUPPORT_URL|BUG_REPORT_URL' && cat /proc/cpuinfo | grep -vE 'Serial'
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
# ...
# ... Above is repeated per CPU core, edited out redundent info
# ...
Hardware : BCM2709
Revision : a01041
Bassed off error given and that browsers could not connect on http://RPi_IP:3000/yt-stream/
even when I managed to force the process to stay alive via forever start picast.js
command from wthin ~/PiCAST
directory it seems to be something within picast.js
or package.json
that is missing or causing errors. If you clue me in on possible edits to these files I'll try'em out.
Raspberry Pi Zero V1.3 (the one with the camera), install took at least 6 hours (went to bed after that point so I don't know how much longer it took) but I assumed it worked however doing:
cd ~/PiCAST
sh picast_start.sh
it outputs the expected Starting PiCAST3...
waits a few seconds then outputs:
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: picast.js
then just quits with no error.
I tried adding --minUptime 10000 --spinSleepTime 10000 in the picast_start.sh file but it still says they're not set (with and without the --).
After I ran the setup script, PiCast would not start because forever
was not an available command and had not been installed. So I looked at the setup script and ran sudo npm install forever
manually, but npm hadn't been installed.
So I ran sudo apt-get install python-dev python-pip nodejs npm youtube-dl lame mpg321 mplayer livestreamer git build-essential -y
just to make sure all the packages were installed, but this command failed with the following error
WARNING: The following packages cannot be authenticated!
librtmp1 rtmpdump
E: There are problems and -y was used without --force-yes
I am currently trying to install those packages, but I'm getting a 403 Forbidden on the dl.bintray.com/pippleware distros, maybe this is what's causing the issue. I'm going to leave this here in case anyone else is having this problem and/or has a solution while I work on it.
Hi,
There is a double qoute missing on row 5 in the file "goCAST.php":
$res = mysql_connect("localhost","picast,"piCAST1337");
Should be:
$res = mysql_connect("localhost","picast","piCAST1337");
Also, in the installation instructions, the table is namned "picaster" but in the end of "goCAST.php" its trying to connect to "vsweb_picast" instead of "picaster". (Line 48)
The README contains this language:
AT NO TIME MAY YOU SELL THIS PROGRAM, EVER UNLESS GIVEN EXTENSIVE PERMISSION. YOU MUST LINK TO THIS PROJECT IF YOU USE ANY CODE PROVIDED OR PUT THIS PROGRAM ON A RASPBERRY PI, ESPECIALLY IF YOU'RE TRYING TO SELL FOR PROFIT.
That's against the gplv3. The gplv3 doesn't prevent anyone from selling your software. Further, the gplv3 prohibits you from adding additional requirements like this one.
Please remove this language from the README.
according to https://github.com/nodesource/distributions/blob/master/OLDER_DISTROS.md
you need clang installed for wheezy:
#!/bin/bash
if [ "x${DIST}" == "xwheezy" ]; then
echo "Calling $0"
apt-get update
apt-get -y install curl apt-transport-https ca-certificates
echo "deb https://deb.nodesource.com/clang-3.4 wheezy main" >> /etc/apt/sources.list
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
apt-get update
apt-get install -y clang-3.4
fi
Hi there,
Well, everynthing is in the title, I'm kind of a noob so not sure what could I say.
On a Rpi 3 with Raspian up to date, I downloaded the setup.sh file in my home folder, ran chmod +x setup.sh
, setup.sh is now executable but nothing happend, so I tried setup.sh
and sh setup.sh
, but only get this in return setup.sh: 8: setup.sh: Syntax error: newline unexpected
.
If I browse to http://ip-to-your-Pi:3000
replacing with my ip, I have a connexion failure (in french : "La connexion a échoué").
I'm a noob but usually find my way, but now I have now clues what's wrong, but that it seems that there is an error, maybe at the 8th caracter, or line 8 ?
Any help would be welcome.
Thank's in advance.
I was using the Picast while loading the sh file this occured:rp@erp:~/PiCAST $ sh picast_start.sh
Starting PiCAST3...
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'express'
Require stack:
i thought picast was installed correctly but when i open another terminal to cast some video just says that pic_ytvideo command not found. dont know what to do at this point, im very new with rpi and raspbian :/
tyvm Lance for this great project, regards from Argentina
To reduce the delay till the task is started, you could check in the goCAST.php if a task is is running and if not, just start the new task without saving it into the mysql Items table.
Would it be possible to not to perform the system upgrade unconditionally? I'm not sure that all packages should receive their minor updates to make PiCAST work. But it takes a heck amount of time and risky to do without a backup.
What can be done instead:
apt-get upgrade
, and wait for responseapt-get upgrade
with timeout defaulting to YesThanks.
PS. Still waiting upgrade to terminate.
Hi,
I would like to know when PiCast 3 will be out.
Thanks
how do i entirely remove picast and also the libs it installed not only the folder
It would be better to change the database to have a type field and a data field.
That way you can add unlimited features without adding extra database fields.
Also, you should really look at the vulnerabilities of mysql injections. Even though this is supposed to be hosted on a private network, it's still better to always use some way of sanitizing the input. You could use mysql_real_escape_string to prevent data from creating mysql errors, which in itself could be a good idea because because single quotes are valid url characters, which would cause problems with your current code.
in the installer file on line 112 it directs to file mirori, this should read midori.
Hello!
I think this project has a lot of future, specially if a "Application runner" could be added, in the same manner Chromecast Apps work, basically using the PiCAST API to open a URL in it's browser and leave the APP talk using the API from there on.
Same Chromecast Applications could be called from the PiCAST and run them right away (they are all HTML5, CSS and Javascript).
Chromecast developers could just migrate they apps to PiCAST with minimal pain.
What do you think about it?
It would be faster to compile software with the -j4
parameter on make
using multicore systems (Pi 2, 3). Checking if commands are successfully executed before continuing with the installation process will reduce unsuccessful installations due to errors.
PS: No need for forever
, the server can be wrapped in a while true
statement.
Hello,
I really liked your project.
So much that I've created a clone in python and sqlite.
https://github.com/sauloal/PiCastPy
There's no dependencies except sqlite and python. No apache, mysql or php.
Please check it out and let me know what do you think.
Regards and many thanks.
I type in http://localhost/PiCAST.php?website=google.com and google crome on my laptop doesnt do anything it just says opps! Google Chome could not find this url. whats wrong?
"sudo ./configure --arch=armel"
shouldnt it be armhf if its a pi 3(A/B)?
Currently PiCAST is vulnerable to arbitrary command execution due to the fact that it uses the command line to play videos.
Here is an example of an input that would cause unintended command execution:
localhost:3000/yt-stream/$(zenity --info --text "Arbitrary Command")
In order to fix this, you may want to add a way of making sure that the youtube video id is valid and does not contain $(SOME_COMMAND)
.
This project needs a license so it can be legally used/downloaded/forked.
The url
query param might contain shell escape or pipeline characters, such as |
or ;
, resulting in remote code execution:
Line 12 in ed6a7ba
It isn't open source until you distribute the code under an open source license. Please add a LICENSE file.
As per title...
Thanks!
pi@picast:~/PiCAST $ bash picast_stop.sh
Stopping PiCAST...
error: Forever cannot find process with id: picast.js
pi@picast:~/PiCAST $ bash picast_start.sh
Starting PiCAST3...
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: picast.js
pi@picast:~/PiCAST $ sudo netstat -tlp
Connexions Internet actives (seulement serveurs)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp 0 0 localhost:8953 *:* LISTEN 515/unbound
tcp 0 0 localhost:domain *:* LISTEN 515/unbound
tcp 0 0 *:ssh *:* LISTEN 409/sshd
tcp6 0 0 localhost:8953 [::]:* LISTEN 515/unbound
tcp6 0 0 [::]:ssh [::]:* LISTEN 409/sshd
And I can't acess IP:3000.
Instead of having a section called "THIS ISN'T CHROMECAST! YOU LIE!!!" and saying "I made it very clear, this is "LIKE" a chromecast", how about just be actually upfront about the state of the project.
PiCAST turns your $35 Raspberry Pi in to a Chromecast and beyond like Device.
(emphasis added)
It sounds like you're saying it can do everything the Chromecast can and more, or at least just about.
(Whereas it doesn't seem even to work. Am I supposed to find and use the version 2 branch?)
Hello,
I would like to uninstall PiCAST please. I prefer to start it manually.
I do not find any solutions ...
The branches dropdown doesn't work in either the default browser nor Chromium, so i can't select picast 2 and/or any of its files for download, I can't even go to the repo page. So please guide me on how to get picast going. Thanks.
The Oculus Quest 2 VR headset can cast its video to a Chromecast, so that friends and family can watch what you're experiencing in VR.
I want to use my Raspberry Pi to cast that video to my television. IF it were just an http:// I could make the magic happen from there, so I started to look at this PiCast project.
I need to do some research, as one can cast the Quest 2 to an iPhone, Android Device or Chromecast - but I don't know, technically, how its doing so... anyone have any tips, suggestions or roadblocks to this? I'll post any updates if I get PiCast working for this use case, but thought I'd drop a line first.
Thanks for any input or discussion.
Hi Lance,
yesterday I saw this repository and I wanted to make some contributions.
I've realized your code have some errors related to the use of the database, for example the installer.sh creates a database called "picaster" (line 67) and when you use it on PHP files you select "picasts" database (line 7 from goCAST.php). Readme file also mentions "picast" database. Another issue is the insert sentence where you try to insert on "vsweb_picast" database.
Also the Items table can be easily be improved with a different schema:
(ID
,kind
,parameter
, requestedtime
) fields should be enough. I guess an Item can be only of a kind: website, youtube, and so.
I don't know if you prefer to develop this project on your own.
If you don't, I can pull requests so some of these bugs can be fixed.
We'll keep in touch.
Have a nice day
Hello,
does picast 3 also work on cubietruck?
Thanks you
Great project, but i have a question is there a way to run this software on a android phone to use that as a chromecast?
I have an Ubuntu Mate 16.04 running on the Pi.
I am using the setup.sh script to get picast intalled.
The script works fine, till it states the following error:
setup.sh: 63: read: Illegal option -n
setup.sh: 65: setup.sh: [[: not found
Maybe the read tool in ubuntu is different?
"read: usage: read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]"
Do you have any idea? (I am not the Linux pro, so sorry if the solution is trivial)
And when I try to start picast I get the following message:
user1@pi02:~/PiCAST$ /etc/init.d/picast start
/usr/bin/env: ‘node’: No such file or director
The rights seems to be ok
user1@pi02:~/PiCAST$ ls -lah /etc/init.d/ | grep picast
-rwxr-xr-x 1 root root 360 Apr 29 15:29 pi
Do you have any idea?
In which path should this .cfg file, which is mentioned in the youtube tutorial has to be?
Cheers!
Haven't tested this out yet but it seems like you are using downloading the full video/audio before starting playback through mplayer. If this is indeed the case it would cause quite a delay before the audio/video plays, correct?
You should be able to parse a youtube page and extract the exact video url and use that to stream directly to mplayer, which would allow a much shorter delay before starting playback. An example of this can be seen here:
Does PiCAST 3 and the Raspberry Pi 3 have any correlation? Can I use this on my my Pi Zero as it doesn't seem to work.
Can't we take a look at the source of cheapcast and implement it in our way? That would be awesome, than we can act like it so we can use it in apps like Youtube, Google Play Music and so on...
I would like to hear the possibilities!
Thanks.
Is that on the roadmap? I'd love to try it, but I'm wary of installing things that I'll have to manually uninstall my stepping through the setup file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.