Record An IP Cam Network Stream In Linux
Page 1 of 1
Record An IP Cam Network Stream In Linux
- Code:
ffmpeg -i rtsp://192.168.241.1:62156 -acodec copy -vcodec copy output.mp4
For Linux Mint 18.1 Update:
- Code:
#!/bin/bash
if ping -c 1 192.168.0.34 &> /dev/null
then
echo "Host Up... Recording Stream"
# recordCam.sh AKA test.sh AkA Run.sh
#
# Function Cam will also work if you have set that up!
#
# ------------
# This script saves the live video from the Foscam IP camera to a full-quality mp4 file.
# I chose to split the files every 15 minutes (900 seconds), to quickly find the time I need.
# Note: audio is not saved as my cameras don't have a microphone connected to them.
# -----------
# Author: @LucaTNT
# License: BSD
# Uncomment this line if you're having trouble with zero-sized files (typically happens on low end cameras), thanks Eric! (https://lucatnt.com/2014/08/record-and-archive-video-from-ip-cameras/#comment-48019)
# killall -INT ffmpeg
# The file name. I use the date to make finding files easier.
name="`date +%Y-%m-%d_%H.%M`"
# Where the videos will be saved
BASEpath='/home/jay/Documents/Scripts/IP-Cam_Stream_Recorder/'
#
cd $BASEpath
# Save the streams using ffmpeg at 30 fps, stopping the capture after 900 seconds (15 minutes). Add more lines if you have more than 2 cameras
ffmpeg -i rtsp://admin:password@192.168.0.34:554 -r 30 -vcodec copy -an -t 60 $BASEpath/video/cam01/$name.mp4
#
name="`date +%Y-%m-%d_%H.%M`"
else
echo "No Cam Stream Available"
fi
Bash RC Function
- Code:
sudo gedit .bashrc
- Code:
function Cam (){
sudo /home/jay/Stream_Recorder/loop_test.sh
Cam
}
Last edited by jamied_uk on 12th February 2018, 18:13; edited 4 times in total
Re: Record An IP Cam Network Stream In Linux
Script
lucatnt.com/2014/08/record-and-archive-video-from-ip-cameras/
- Code:
#!/bin/bash
# recordCam.sh AKA test.sh
# ------------
# This script saves the live video from the Foscam IP camera to a full-quality mp4 file.
# I chose to split the files every 15 minutes (900 seconds), to quickly find the time I need.
# Note: audio is not saved as my cameras don't have a microphone connected to them.
# -----------
# Author: @LucaTNT
# License: BSD
# Uncomment this line if you're having trouble with zero-sized files (tipically happens on low end cameras), thanks Eric! (https://lucatnt.com/2014/08/record-and-archive-video-from-ip-cameras/#comment-48019)
# killall -INT ffmpeg
# The file name. I use the date to make finding files easier.
name="`date +%Y-%m-%d_%H.%M`"
# Where the videos will be saved
BASEpath='/home/jay/scripts/Stream_Recorder'
RECpath=$BASEpath'/video'
# Save the streams using ffmpeg at 30 fps, stopping the capture after 900 seconds (15 minutes). Add more lines if you have more than 2 cameras
ffmpeg -i rtsp://admin:password@192.168.100.10:554 -r 30 -vcodec copy -an -t 900 $RECpath/cam01/$name.mp4
lucatnt.com/2014/08/record-and-archive-video-from-ip-cameras/
Last edited by jamied_uk on 21st November 2016, 22:55; edited 1 time in total
Re: Record An IP Cam Network Stream In Linux
Record Stream Function For Linux
add to your .bashrc file (via sudo) then start a new terminal window and type Cam
(also change to your own folder names etc! aLSO MAKE SURE FOLDER EXISTS > video/cam01
Example:
/home/jay/scripts/Stream_Recorder/video/cam01 )
After it runs once it wont run again, it has a time limit (900) with -t tag
you can use crontab or cronjobs to choose when to record or maybe even use a call to the function after it finishes so it loops that way
- Code:
function Cam (){
cd /home/jay/scripts/Stream_Recorder
sudo ./test.sh
}
add to your .bashrc file (via sudo) then start a new terminal window and type Cam
(also change to your own folder names etc! aLSO MAKE SURE FOLDER EXISTS > video/cam01
Example:
/home/jay/scripts/Stream_Recorder/video/cam01 )
After it runs once it wont run again, it has a time limit (900) with -t tag
you can use crontab or cronjobs to choose when to record or maybe even use a call to the function after it finishes so it loops that way
Re: Record An IP Cam Network Stream In Linux
Looping
and the updated example for looping 60 = seconds change to what you wish to loop must be at least 1 minute!
- Code:
function Cam (){
cd /home/jay/scripts/Stream_Recorder
sudo ./loop_test.sh
Cam
}
and the updated example for looping 60 = seconds change to what you wish to loop must be at least 1 minute!
- Code:
name="`date +%Y-%m-%d_%H.%M`"ffmpeg -i rtsp://admin:password@192.168.0.34:554 -r 30 -vcodec copy -an -t 60 $RECpath/cam01/$name.mp4
Last edited by jamied_uk on 12th February 2018, 17:55; edited 2 times in total
Re: Record An IP Cam Network Stream In Linux
Motion Detection
(Note: This will create a hidden folder .motion in your Home directory.)
(Note: This command will copy the original motion configuration file to its location.)
Now can open the configuration file for editing:
After you you have made all the appropriate adjustments to the configuration file, close it. Then start motion in the terminal simply by typing:
motion
Or
htmlpreview.github.io/?https://github.com/Motion-Project/motion/blob/master/motion_guide.html#Install_Build
lavrsen.dk/foswiki/bin/view/Motion/WebHome
- Code:
sudo apt-get install -y gdebi-core motion
- Code:
mkdir .motion
(Note: This will create a hidden folder .motion in your Home directory.)
- Code:
cp /etc/motion/motion-dist.conf ~/.motion/motion.conf
(Note: This command will copy the original motion configuration file to its location.)
Now can open the configuration file for editing:
- Code:
sudo nano ~/.motion/motion.conf
After you you have made all the appropriate adjustments to the configuration file, close it. Then start motion in the terminal simply by typing:
motion
Or
- Code:
use Git
- Code:
cd ~
- Code:
git clone https://github.com/Motion-Project/motion.git
- Code:
cd motion
- Code:
autoreconf -fiv
- Code:
./configure
- Code:
make
- Code:
make install
htmlpreview.github.io/?https://github.com/Motion-Project/motion/blob/master/motion_guide.html#Install_Build
lavrsen.dk/foswiki/bin/view/Motion/WebHome
Last edited by jamied_uk on 23rd November 2016, 16:47; edited 2 times in total
Re: Record An IP Cam Network Stream In Linux
Other Alternatives
encrypted.google.com/search?q=how+to+identafie+mp4+files+that+have+movement
encrypted.google.com/search?q=how+to+detect+motion+using+linux+and+a+network+ip+cam+stream
encrypted.google.com/search?q=how+to+identafie+mp4+files+that+have+movement
encrypted.google.com/search?q=how+to+detect+motion+using+linux+and+a+network+ip+cam+stream
Re: Record An IP Cam Network Stream In Linux
For starting VLC IP Cam Stream Via Batch File
https://jnet.forumotion.com/t1468-start-a-cam-stream-via-windows-batch-file-script-shortcut
https://jnet.forumotion.com/t1468-start-a-cam-stream-via-windows-batch-file-script-shortcut
Re: Record An IP Cam Network Stream In Linux
Make sure the folders you need are created if you get errors that they dont exist make sure you create them
Similar topics
» NETWORK IP CAMS FOR LINUX
» stream media to ps3 from pc linux
» Multiple ways to record your desktop on linux!
» Record Audio and screen capture with 1 command on Linux
» Linux Record Desktop Function & Serve Current Folder Via Python Web Server
» stream media to ps3 from pc linux
» Multiple ways to record your desktop on linux!
» Record Audio and screen capture with 1 command on Linux
» Linux Record Desktop Function & Serve Current Folder Via Python Web Server
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum