Capture video stream using FFmpeg with specific time
Capture video stream using FFmpeg with specific time
01 December, 2018
A small script to capture video stream (eg: from a security camera). The script takes in time in format of HH:MM:SS and created directories based on the current date. Based on the current variables, it outputs the files to /opt/camera/recordings/. It also needs a temp directory, called streams under /opt/camera/.
Usage example (to capture 11 minutes of the stream): capture.sh 00:11:00
#!/bin/bash
STREAM="rtsp://172.16.0.25:554/play2.sdp" FILE="cam" TIME=$1 # in 00:00:00 format OUT=$FILE-`date '+%m-%d-%y_%H_%M'` CWD=/opt/camera DATE=`date '+%m-%d-%y'`
if [ ! -d $CWD/streams] then mkdir -p $CWD/streams fi