Skip to main content

Video Streamming

  1. Have raspbian installed and updated and make sure your camera is enabled (you enable this by running sudo raspi-config and choose Enable Camera)
    sudo apt-get update
    sudo apt-get upgrade
    
  2. Install vlc
    sudo apt-get install vlc
    
  3. Create a script to start the stream with the following content, or run the command (you can't do anything else if you just run the command).
    sudo nano myscript.sh
    raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554}' :demux=h264
    
  4. Make the script runable
    sudo chmod +x myscript.sh
    
  5. If you want to start the stream automatically you have to add the script to crontab. To make this work I had to make another script runned by cron (OBS! VLC can't be run as sudo so make sure you're in the right cron). sudo nano myscript2.sh:
    #!/bin/bash
    /path/to/myscript.sh
    
    Then:
    sudo chmod +x myscript2.sh
    crontab -e
    @reboot /path/to/myscript2.sh
    
  6. To watch the videostream, open VLC on a computer on the same network as the raspberry pi you are using for streaming. Press Media -> Open Networkstream and paste the following in the field:
    rtsp://[IP].[TO].[THE].[PI]:8554/
    
If you don't care about FPS (frames per second) and don't want any delay you could use MJPEG. You can read more about this HERE
Watch THIS wiki about Raspberry Pi Camera Module. Hope you find what you're looking for.

Comments

Popular posts from this blog

Raspberry pi Ser2Net Install

sudo apt-get install ser2net sudo nano /etc/ser2net.conf % change last lines to 2000:raw:600:/dev/ttyAMA0:57600 8DATABITS NONE  1STOPBIT banner sudo /etc/init.d/ser2net restart sudo nano /etc/inittab % add hash to this line #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 sudo nano /boot/cmdline.txt % delete references to ttyAMA0 % "console=ttyAMA0,115200 kgdboc=ttyAMA0,115200" sudo shutdown -r now

Modem Connection with raspberry py

Aim : Set up the  Raspberry Pi  as a wireless router using the Raspbian OS. The internet connection will be provided by a  Huawei E303  USB 3g dongle on the safaricom network in Kenya, though the setup should be similar on most Huawei dongles and 3g networks. The wireless access point will be provided by an  Edimax Nano USB Wifi adapter . Power Source -------->RPI ----> Powered USB HUB -----> 3g Dongle                                            |                                            |                                          Edimax                       ...

OpenCV Docker Image and use

Open CV Install docker mage run $ docker ps $ docker start 0c5f0bc9b04c $ docker ps -a We need to go Self terminal not SSH terminal $ gksudo open a bog and type lxterminal Python and OpenCV. Alright, now we can finally start writing some code! Open up a new file, name it   test_image . py  , and insert the following code: Accessing the Raspberry Pi Camera with OpenCV and Python Python 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 # import the necessary packages from picamera . array import PiRGBArray from picamera import PiCamera import time import cv2   # initialize the camera and grab a reference to the raw camera capture camera = PiCamera ( ) rawCapture = PiRGBArray ( camera )   # allow the camera to warmup time . sleep ( 0.1 )   # grab an image from the camera camera . capture ( rawCapture , format = "bgr" ) image = rawC...