How to setup video steaming in Raspberry Pi 

I am using Raspberry Pi 3 and Logitech HD720P camera for this demo.  


Step 1. First step is to assign local IP address or static IP address for your Raspberry Pi board. Ignore this step if you have already assigned one.


The default local IP address used is, last number can be any number depending on number of devices connected to your DNS/DHCP server (your local home network). Make sure the number you assign don’t conflict with number already assigned by DNS/DHCP to other device. 


In my case I am using, edit this file and add this IP as shown below and reboot machine. 




Robotics and Coding Training


Now you should be able to access your machine using this static IP remotely on Putty or any other tool to access machine remotely. 


Step 2: Once you have IP address set, run below command to update / upgrade Raspberry PI.


sudo apt-get update

sudo apt-get upgrade


Step 3: Install these packages using below command


sudo dpkg -i ffmpeg_3.1.1-1_armhf.deb


Step 4: Install these library files


sudo apt-get install curl libssl-dev libcurl4-openssl-dev libjpeg-dev libx264-142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5


Step 5: Once you have all Library file installed, check if you have Motion installed already, if its already installed moved to step 6 or install Motion software


sudo apt-get install motion














Step 6: Edit motion.conf file  /etc/motion/motion.conf


daemon on
stream_localhost off


#Change these line to off.


output_pictures off
ffmpeg_output_movies off


#To do realtime streaming and smooth video change values (100 or 80 or 50)


stream_maxrate 100            
framerate 100


# Check your video size on the screen and update accordingly, to change width and hight of image


width 640 
height 480 



Step 7: If you want to run video streeming from boot-up, make below changes or switch to next step to run Video streaming manually


Edit  file  /etc/default/motion as below


Now restart machine, once you reboot, go to step 9


Step 8: To start service manually you can run either sudo motion or below command

















To stop video steaming, just enter stop in above command instead of start .


Below command to restart service.


sudo service motion restart


Step 9: Now you can access the Video from Raspberry camera to remote machine using this IP address on your browser over port 8081. Please make sure your camera hardware has powersupply(if required) and light is ON.


If you want to access your Raspberry camera video over internet outside your house network, than assign static IP provided by your internet service provider to Raspberry PI.


Please let me know if you have any questions and add your comments below. Thank you for reading,


If possible please like us on Facebook.