save to mkv ~10mbps

  • raspivid -hf -vf -t 0 -b 10000000 -o - | ffmpeg -i - -vcodec copy test.mkv

explanation

Raspvid

  • -hf flip horizontal
  • -vf flip vertical
  • -t 0 indefinetly
  • -b 10000000 10mbps bitrate
  • -o -output to ffmpeg

ffmpeg

  • -i - reads from raspivid
  • -vcodec copy simple copying of video data
  • test.mkv file name and the output matroska format

Easier way to install or build mpv with mmal hardware decoding and ffmpeg/libass

Install

  • mkdir rpimpv && cd rpimpv
  • wget https://awesome.nwgat.ninja/deb/mpv/mpv_0.20.0_armhf.deb https://awesome.nwgat.ninja/deb/mpv/libass_0.13.3-1_armhf.deb https://awesome.nwgat.ninja/deb/mpv/ffmpeg_3.1.3-1_armhf.deb
  • sudo dpkg -i *.deb
  • sudo apt-get -f install
  • sudo apt-get install libluajit
  • wget https://awesome.nwgat.ninja/deb/mpv/mpv.conf -O $HOME/.config/mpv/mpv.conf
  • sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
  • sudo chmod a+rx /usr/local/bin/youtube-dl

Play a file

  • mpv http://ow.ly/10tB0C (Big Buck Bunny 1080p30)
  • mpv https://www.youtube.com/watch?v=aqz-KE-bpKQ (Big Buck Bunny 1080p30)

mmal error

  • sudo su
  • echo "gpu_mem=159" >> /boot/config.txt
  • echo "gpu_mem=256" >> /boot/config.txt (rpi2/rpi3)
  • sudo reboot

you can tweak the settings in mpv config file, if you need to move the window or change resolution of youtube, it currently defaults to 1080p30

  • nano $HOME/.config/mpv/mpv.conf

note: it will default to borderless non-movable window, this is a limitation of raspberry pi

Build it yourself

  • sudo apt-get install -y gperf bison flex autoconf automake make texinfo help2man libtool libtool-bin ncurses-dev git yasm mercurial cmake cmake-curses-gui libfribidi-dev checkinstall libfontconfig1-dev libgl1-mesa-dev libgles2-mesa-dev gnutls-dev libsmbclient-dev libpulse-dev libbluray-dev libdvdread-dev libluajit-5.1-dev libjpeg-dev libv4l-dev libcdio-cdda-dev libcdio-paranoia-dev
  • git clone https://github.com/mpv-player/mpv-build.git
  • cd mpv-build
  • echo --enable-mmal >> ffmpeg_options
  • ./use-mpv-release
  • ./use-ffmpeg-release
  • ./update
  • ./rebuild -j4
  • sudo ./install

omxplayer seem to be the best player, almost 0% cpu usage!

  • sudp apt-get update && sudo apt-get install omxplayer -y
  • omxplayer -b -o hdmi http://awesome.nwgat.ninja/misc/Commie_typesetting_shenanigans.mp4

the above command can be run via ssh connection

  • -o hdmi will send it to your RPi Display
  • -b blacks the background

there is no gui, you only get fullscreen, its still better than other players
omxplayer -h gives you more info

banding/color issues? try forcing 32-bit

  • echo "framebuffer_depth=32" >> config.txt
  • echo "framebuffer_ignore_alpha=1" >> config.txt

go home ;)

  • cd /home/pi/

setup i2c

  • sudo apt-get update && sudo apt-get install -y python-smbus i2c-tools
  • sudo su
  • echo "i2c-bcm2708" >> /boot/config.txt
  • echo "i2c-dev" >> /boot/config.txt

Install pigpio

  • su pi
  • git clone https://github.com/joan2937/pigpio && cd pigpio
  • sudo make && sudo make install
  • sudo pigpiod
  • sudo su
  • echo "pigpiod" >> rc.local

Install dalexgray's htu21 libary and get zerosensor

  • su pi
  • git clone https://github.com/nwgat/zerosensor
  • git clone https://github.com/dalexgray/RaspberryPI_HTU21DF
  • cp RaspberryPI_HTU21DF/HTU21DF.py zerosensor/
  • cd zerosensor && python HTU21DF.py install
  • sudo pip install arrow

Run zerosensor

  • rm -r data/data
  • rm -r data/data.json
  • python2 zerosensor-basic.py (basicly logs to data file with format temp,humidity,time
  • python2 zerosensor-db.py (logs to mongodb)

Start the web server

  • python zerosensor-httpd.py
  • go to http://pizero:9000
  • if you want to run it on port 80 aka http://pizero/ you can redirect it
  • sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 9000
Easily deploy an SSD cloud server on @DigitalOcean in 55 seconds. Sign up using my link and receive $10 in credit
Proudly published with Ghost | Theme based on Draugur | Header Image by GUWEIZ@DeviantArt
Creative Commons Licence