@@ -7,7 +7,7 @@ Provides a simple interface to set FFMPEG options and capture video from an RTSP
77Lots of other libraries out there do ffmpeg and rtsp things, but I couldn't find
88any that fit this simple task of "get a video snippet from a camera."
99
10- - [ GODOC] ( https://godoc.org /golift.io/ffmpeg )
10+ - [ GODOC] ( https://pkg.go.dev /golift.io/ffmpeg )
1111
1212## Example
1313
@@ -21,29 +21,40 @@ import (
2121)
2222
2323func main () {
24- /* Example non-transcode direct-save from securityspy. */
24+
25+ /*
26+ * Example non-transcode direct-save from securityspy.
27+ */
2528
2629 securitypsy := " rtsp://user:[email protected] :8000/++stream?cameraNum=1" 2730 output := " /tmp/securitypsy_captured_file.mov"
31+
2832 c := &ffmpeg.Config {
2933 FFMPEG: " /usr/local/bin/ffmpeg" ,
3034 Copy: true , // do not transcode
3135 Audio: true , // retain audio stream
3236 Time: 10 , // 10 seconds
3337 }
38+
3439 encode := ffmpeg.Get (c)
3540 cmd , out , err := encode.SaveVideo (securitypsy, output, " SecuritySpyVideoTitle" )
41+
3642 log.Println (" Command Used:" , cmd)
3743 log.Println (" Command Output:" , out)
44+
3845 if err != nil {
3946 log.Fatalln (err)
4047 }
48+
4149 log.Println (" Saved file from" , securitypsy, " to" , output)
4250
43- /* Example transcode from a Dahua IP camera. */
51+ /*
52+ * Example transcode from a Dahua IP camera.
53+ */
4454
4555 dahua := " rtsp://admin:[email protected] /live" 4656 output = " /tmp/dahua_captured_file.m4v"
57+
4758 f := ffmpeg.Get (&ffmpeg.Config {
4859 Audio: true , // retain audio stream
4960 Time: 10 , // 10 seconds
@@ -54,14 +65,16 @@ func main() {
5465 Rate: 5 ,
5566 Prof: " baseline" ,
5667 })
68+
5769 cmd, out, err = f.SaveVideo (dahua, output, " DahuaVideoTitle" )
70+
5871 log.Println (" Command Used:" , cmd)
5972 log.Println (" Command Output:" , out)
73+
6074 if err != nil {
6175 log.Fatalln (err)
6276 }
77+
6378 log.Println (" Saved file from" , dahua, " to" , output)
6479}
65-
66-
6780```
0 commit comments