Skip to content

Instantly share code, notes, and snippets.

@bilson
Forked from mowings/readme.md
Created April 9, 2024 20:51
Show Gist options
  • Select an option

  • Save bilson/c2a26fb13fd2b90ad48a1f42d6ab9dbd to your computer and use it in GitHub Desktop.

Select an option

Save bilson/c2a26fb13fd2b90ad48a1f42d6ab9dbd to your computer and use it in GitHub Desktop.
ffmpeg stream and save video from Dahua 4300s IP Camera

Stream to file

ffmpeg -loglevel debug -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/live"
-c copy -map 0 foo.mp4

10 second segments

ffmpeg -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/live"
-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1
-c copy -map 0 test%d.mp4

10 second segments, timestamped output

ffmpeg -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/live"
-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1
-strftime 1 -c copy -map 0 dauphine-%Y%m%d-%H%M%S.mp4

Read from streams. subtype determines stream: 0 = main, 1 = sub

ffmpeg -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=1" \ -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 \ -strftime 1 -c copy -map 0 test-%Y%m%d-%H%M%S.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment