s.w*_*dit 12 gstreamer h.264 v4l2
我正试图从/dev/video0带有Gstreamer 1.0 v4l2src元素的本地安装的Logitech C920相机捕获H264流.
v4l2-ctl --list-formats 表明相机能够提供H264视频格式:
# v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
...
Index : 1
Type : Video Capture
Pixel Format: 'H264' (compressed)
Name : H.264
...
Run Code Online (Sandbox Code Playgroud)
但管道
# gst-launch-1.0 -vvv v4l2src device=/dev/video0 ! video/x-h264, width=800, height=448, framerate=30/1 ! fakesink
一直给我not-negotiated (-4)错误:
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-h264, width=(int)800, height=(int)448, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-h264, width=(int)800, height=(int)448, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-h264, width=(int)800, height=(int)448, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-h264, width=(int)800, height=(int)448, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2809): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 67687169 ns.
Run Code Online (Sandbox Code Playgroud)
任何帮助!
Vin*_*ren 12
gstreamer是否符合您的需求?Logitech C920在H264模式和gstreamer中也存在很多问题.但我设法使用VLC作为RTSP服务器将C920用于H264:
$ cvlc -v v4l2:///dev/video0:chroma="H264":width=1024:height=570:fps=30 \
--sout="#rtp{sdp=rtsp://:8554/live}"
Run Code Online (Sandbox Code Playgroud)
然后我可以将另一个VLC连接到URI rtsp:// localhost:8554/live
如果GStreamer对你来说是强制性的,我只能设法使用你可以在这里找到的捕获工具:https://github.com/csete/bonecam - 目录"capture"
你必须编译它,但如果你有一些编程技巧,它应该很容易,因为只有一个C文件和一个脚本可以提供帮助.只需将"host"作为参数传递给脚本:
# Get the bonecam/capture content or git clone the directory, and then
$ cd bonecam/capture
$ ./build host
Run Code Online (Sandbox Code Playgroud)
您可以使用"捕获"实用程序:
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1024,height=570,pixelformat=1
$ v4l2-ctl -d /dev/video0 --set-parm=30
$ ./bonecam/capture/capture -d /dev/video0 -c 100000 -o | \
gst-launch -e filesrc location=/dev/fd/0 ! legacyh264parse ! rtph264pay ! udpsink host=10.0.0.42 port=5000
Run Code Online (Sandbox Code Playgroud)
如果您不想指定要获取的帧数("-c"参数带有"capture"),则可以在此处找到此实用程序的分支:https://github.com/DeLaGuardo/bonecam
我知道有一个分类为"坏"的插件,gstreamer 0.10称为uvch264,应该与C920配合使用.但我不知道gstreamer 1.0,我无法测试它.
UPD:
不要忘记添加--rtsp-timeout=-1到cvlc命令行像
$ cvlc -v v4l2:///dev/video0:chroma="H264":width=1024:height=570:fps=30 \
--sout="#rtp{sdp=rtsp://:8554/live}" --rtsp-timeout=-1
Run Code Online (Sandbox Code Playgroud)
如果没有此选项,默认情况下,流式传输仅持续60秒.
| 归档时间: |
|
| 查看次数: |
38321 次 |
| 最近记录: |