我正在尝试使用 ubuntu(服务器)中的 avconv 从 IP 摄像机捕获单个静态图像。
有人能告诉我以下命令有什么问题吗:
avconv -i rtsp://[USER]:[PASS]@[IPADDRESS]:554/11 -s 1920x1080 -f image2 foo.jpg
我目前收到的错误信息是:
avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
[rtsp @ 0xb938e0] Could not find codec parameters (Video: h264, 1920x1080)
[rtsp @ 0xb938e0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://xxx:[email protected]:554/11':
Metadata:
title : rtsp session
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264, 1920x1080, 90k tbn
Stream #0.1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
[buffer @ 0xb98520] Invalid pixel format string '-1'
Error opening filters!
如果它有任何价值,我正在使用 Sinocam 的 2.0 MB IP 摄像头。我能够使用 iSpy 远程查看摄像头的实时流。但是,我仍然无法使用 avconv 访问和创建图像。
谢谢。
更新
avconv -i rtsp://[user]:[pass]@[ip]:554/11 -f h264 -pix_fmt yuyv422 -video_size 1920x1080 screenshot.png
创建图像文件,但仍然失败:
[rtsp @ 0x1045a80] Could not find codec parameters (Video: h264, 1920x1080)
[rtsp @ 0x1045a80] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://admin:[email protected]:554/11':
Metadata:
title : rtsp session
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264, 1920x1080, 90k tbn
Stream #0.1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
File 'screenshot.png' already exists. Overwrite ? [y/N] y
[buffer @ 0x1035280] Invalid pixel format string '-1'
Error opening filters!
答案1
根据 AVcon 文档:https://libav.org/avconv.html#fbdev
截屏的正确语法(使用 Fbdev)是:
avconv -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
希望这可以帮助。
答案2
终于在网上找到了答案:
avconv -y -loglevel debug -stimeout 2 -rtsp_transport tcp -i "rtsp://[user]:[pass]@[IP]/11" -q:v 9 -s 1920x108 -vframes 1 test.png