Part list to purchase:
1. Raspberry Pi 3 https://amzn.to/2VJIOBy
2. USB camera Logitech https://amzn.to/35w1DMN
Buy electronic component on utsource.net
The following tutorial will show you how to install FFmpeg onto the Raspberry Pi and stream video to the local web which can be access through computer/phone/tablet.
cd /usr/src
git clone git://git.videolan.org/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make
sudo make install
2. Install FFmpegcd /usr/src
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg/
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree
make
Note: Model B+ (4-Cores) can do “make -j4
” instead of “make
”. This "make
" command will take 4 hours long 🠚 take a sleep instead of waiting for it!
sudo make install
3. Config something:gedit /etc/ffserver.conf
Input following settings:
Port 8090
# bind to all IPs aliased or not
BindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 10
# max bandwidth per-client (kb/s)
MaxBandwidth 1000
# Suppress that if you want to launch ffserver as a daemon.
NoDaemon
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 10M
</Feed>
<Stream test.mjpg>
Feed feed1.ffm
Format mpjpeg
VideoFrameRate 4
VideoSize 600x480
VideoBitRate 80
# VideoQMin 1
# VideoQMax 100
VideoIntraOnly
NoAudio
Strict -1
</Stream>
Make execute file for easy command:
gedit /usr/sbin/webcam.sh
Input following settings:
ffserver -f /etc/ffserver.conf & ffmpeg -v verbose -r 5 -s 600x480 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm
Change the mode for file webcam.sh
so it can execute, then run it:
chmod +x /usr/sbin/webcam.sh
/usr/sbin/webcam.sh
After the above command, streaming will be started to local web.
Go to web browser, type address <your-ip-address:8090>/test.mjpg
Note: To stop the camera, press Ctrl+C at terminal, then type command:
pkill ffserver
As a test, I uploaded this video where you can see clock needle rotate every single second!
4. Automatic runIn order to run FFmpeg service without typing the command /usr/sbin/webcam.sh
, go to /etc/rc.local
🠚 then add command line /usr/sbin/webcam.sh
before "exit 0". Every time Raspberry starts up, FFmpeg will automatically run without typing code.
Comments