Skip to content

Instantly share code, notes, and snippets.

@ksophocleous
Last active August 29, 2015 14:02
Show Gist options
  • Save ksophocleous/e9e3928712852f9191c2 to your computer and use it in GitHub Desktop.
Save ksophocleous/e9e3928712852f9191c2 to your computer and use it in GitHub Desktop.
firefox on ubuntu server
#!/bin/bash
set -e
# Assumes that you run update_kernel.sh (another gist of mine)
# export URL=url to open (e.g. http://54.195.58.117/webrtc.html?port=8801)
# export VIDEODEV=video device to send test video stream to (e.g. /dev/video0)
if [ -z "$URL" ]; then
echo "URL variable cannot be empty (e.g. http://54.195.58.117/webrtc.html?port=8801)"
exit 1
fi
if [ -z "$VIDEODEV" ]; then
echo "is empty"; fi
if [ -z "$VIDEODEV" ]; then
echo "VIDEODEV variable must be set to the v4l2 device name (e.g. /dev/video0)"
echo "setting VIDEODEV to /dev/video0"
export VIDEODEV=/dev/video0
fi
sudo add-apt-repository -y ppa:jon-severinsson/ffmpeg
sudo apt-get update
sudo apt-get upgrade -y
#sudo apt-get dist-upgrade -y
sudo apt-get install -y build-essential git xvfb openbox x11vnc firefox gstreamer-tools gstreamer0.10-tools gstreamer0.10-plugins-bad gstreamer0.10-plugins-good fluxbox libopencv-video-dev module-assistant
(cd && git clone https://github.com/umlaeute/v4l2loopback.git)
(cd ~/v4l2loopback && make)
(cd ~/v4l2loopback && sudo make install)
sudo modprobe v4l2loopback
mkdir -p ~/logs
if [ `pgrep Xvfb` ]; then
kill `pgrep Xvfb`
fi
mkdir -p ~/.mozilla/firefox/9jr2jz34.default/
rm -rf ~/.mozilla/firefox/*.default/prefs.js
rm -rf ~/.mozilla/firefox/profiles.ini
echo "[General]
StartWithLastProfile=1
[Profile0]
Name=default
IsRelative=1
Path=9jr2jz34.default" >> ~/.mozilla/firefox/profiles.ini
echo 'user_pref("media.navigator.permission.disabled", true);' >> ~/.mozilla/firefox/9jr2jz34.default/prefs.js
Xvfb :1 -extension GLX -screen 0 1280x960x24 > ~/logs/xvfb.log 2>&1 &
sleep 1
/usr/bin/x11vnc -forever -display :1 > ~/logs/x11vnc.log 2>&1 &
DISPLAY=:1 /usr/bin/openbox > ~/logs/openbox.log 2>&1 &
DISPLAY=:1 /usr/bin/firefox $URL > ~/logs/firefox.log 2>&1 &
gst-launch -v videotestsrc ! "video/x-raw-yuv,width=640,height=360,framerate=30/1,format=(fourcc)I420" ! v4l2sink device=$VIDEODEV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment