Skip to content

Instantly share code, notes, and snippets.

@bafu
Last active November 12, 2020 03:26
Show Gist options
  • Save bafu/bb43a9d97762c78a8d41c8c71a556677 to your computer and use it in GitHub Desktop.
Save bafu/bb43a9d97762c78a8d41c8c71a556677 to your computer and use it in GitHub Desktop.
Record MJPEG/H.264 stream as segments by ffmpeg
#!/bin/bash
# Dynacolor Dynahawk W2V1-H IP Camera
Ip="192.168.0.2"
HttpStreamSource="http://$Ip:8008" # mjpeg, ~3 MB / 1 sec
RtspStreamSource="rtsp://$Ip/h264" # h.264, ~0.3 MB / 1 sec
# Save streaming until pressed 'q'.
# Save a segment every 60 secs.
#ffmpeg -i $HttpStreamSource -c copy -map 0 -f segment -segment_time 60 -segment_format mp4 "capture-%03d.mp4"
ffmpeg -i $RtspStreamSource -c copy -map 0 -f segment -segment_time 60 "capture-%03d.avi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment