我的IP Camera位於192.168.27.101,且有設定密碼,所以用這樣的方式
不然他會跳出輸入帳密的視窗
rtsp://admin:admin123@192.168.27.101
如果有需要在linux下錄的話,可以用vlc或是ffmpeg
其中vlc需要安裝的東西比較多,所以需要到170MB的空間
ffmpeg只需要40幾MB就夠用了
ffmpeg -i rtsp://admin:admin123@192.168.27.101 -r 15 -vcodec copy -an -t 10 ./my-video.mp4
錄製10秒,產生的訊息如下:
ffmpeg version 0.8.18-6:0.8.18-0+deb7u1, Copyright (c) 2000-2014 the Libav developers
built on Oct 4 2016 19:34:59 with gcc 4.6.3
The ffmpeg program is only provided for script compatibility and will be removed
in a future release. It has been deprecated in the Libav project to allow for
incompatible command line syntax improvements in its replacement called avconv
(see Changelog for details). Please use avconv instead.
[rtsp @ 0x40660] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 45000.00 (45000/1)
Input #0, rtsp, from 'rtsp://admin:admin123@192.168.27.101':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264 (Main), yuv420p, 1280x720, 25 fps, 45k tbr, 90k tbn, 50 tbc
Output #0, mp4, to './my-video.mp4':
Metadata:
title : Media Presentation
encoder : Lavf53.21.1
Stream #0.0: Video: libx264, yuv420p, 1280x720, q=2-31, 25 tbn, 25 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
frame= 251 fps= 27 q=-1.0 Lsize= 278kB time=10.04 bitrate= 227.1kbits/s
video:275kB audio:0kB global headers:0kB muxing overhead 1.111131%
所佔的空間不多
279K Nov 8 13:59 my-video.mp4
----> 這指令也可以截一張圖
ffmpeg -i rtsp://admin:admin123@192.168.27.101 -vframes 1 ./pic.jpg
產生訊息:
ffmpeg version 0.8.18-6:0.8.18-0+deb7u1, Copyright (c) 2000-2014 the Libav developers
built on Oct 4 2016 19:34:59 with gcc 4.6.3
The ffmpeg program is only provided for script compatibility and will be removed
in a future release. It has been deprecated in the Libav project to allow for
incompatible command line syntax improvements in its replacement called avconv
(see Changelog for details). Please use avconv instead.
[rtsp @ 0x40660] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 45000.00 (45000/1)
Input #0, rtsp, from 'rtsp://admin:admin123@192.168.27.101':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264 (Main), yuv420p, 1280x720, 25 fps, 45k tbr, 90k tbn, 50 tbc
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
[buffer @ 0x45c20] w:1280 h:720 pixfmt:yuv420p
[avsink @ 0x4b000] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x45540] w:1280 h:720 fmt:yuv420p -> w:1280 h:720 fmt:yuvj420p flags:0x4
Output #0, image2, to './pic.jpg':
Metadata:
title : Media Presentation
encoder : Lavf53.21.1
Stream #0.0: Video: mjpeg, yuvj420p, 1280x720, q=2-31, 200 kb/s, 90k tbn, 45k tbc
Stream mapping:
Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
frame= 1 fps= 0 q=6.7 Lsize= -0kB time=0.01 bitrate= -17.6kbits/s
video:44kB audio:0kB global headers:0kB muxing overhead -100.048788%
沒有留言:
張貼留言