http://blog.csdn.net/wzwxiaozheng/archive/2010/12/26/6099397.aspx

GStreamer资料整理(包括摄像头采集,视频保存,远程监控,流媒体RTP传输)

1,gstreamer开发手册,gstreamer官网(这些都不用说了吧)

2,gst-launch的用法,这也不用说了吧。(白菜,鸡蛋,西红柿,砖头,鼠标……..)

3,http://blog.chinaunix.net/u/6646/showart_164960.html

lqplayer--基于gstreamer和qt的linux下的简单播放器。

实现了基于QT+GST的一个播放器。我下载源码后编译出现了几个BUG,如下:

(1),源码编译不通过,media.cpp下有个地方大概是第54行,g_free(tag_list);,把这个地方注释掉,资源没有申请到还free,当然出错了。(此BUG花了我几十分钟的时间)

(2),界面上的按钮都不能使用,pthread_create(&tid, NULL, cb_run_loop, this);这句要注释掉,我们的主循环使用的是QT的主循环,这个就不必了吧,要不就进GST的死循环了。(这个小BUG花了我某个星期六的一个清晨)

在这里还要说一下快放和慢放的问题:

gint64 value = m_frontend->sliderTiming->value();

m_speed = m_speed+1;

gst_element_seek (m_pipeline, m_speed, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,

GST_SEEK_TYPE_SET, value * GST_MSECOND*1000  ,

GST_SEEK_TYPE_SET, GST_CLOCK_TIME_NONE);

当m_speed为负值时可实现倒放,但是不稳定,仅几秒钟就会出现GST_MESSAGE_EOS。

当m_speed为负值时,我这样实现

gst_element_seek (m_pipeline, m_speed, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,

GST_SEEK_TYPE_SET, GST_CLOCK_TIME_NONE  ,

GST_SEEK_TYPE_SET, value * GST_MSECOND*1000);

无非就是调了个位置,效果好了许多,不妨试一下。(为啥呢,我也不知道,此BUG花了我三四天的时间)

4,http://www.pierrox.net/dvr/releases/dvr-3.99.4.tar.bz2

基于QT3的,实现了GST的采集编码,并保存为avi文件。总感觉这东西写的有些地方让人不爽,又说不出是哪里来。

5,http://blog.chinaunix.net/u3/94516/showart_2269637.html

GStreamer发送视频/音频流至服务器端并播放、保存。

Client实现了gstreamer视频文件的RTP发送,写个vlc的配置文件,使用vlc打开可以在网络上进行观看(vlc的使用和配置文件使用可以从网上搜一下,还是比较多的),效果还不错.源码实现时稍显繁琐。Decodebin的连接要注意一下。还有就是gstrtpbin的连接要仔细看一下,刚开始感觉有些麻烦,错误了好几次。后来才明了了。(此功能的源码实现花了我一整天的时间,早9-晚11)

Server端,试了,没成功,后来就没仔细看。

6,http://www.since1985i.com/tag/gstreamer

Gstreamer实现摄像头采集并显示。不过是命令行下的,相对上面RTP网络的例子来说,这个用源码实现可就是小case了吧。同样结合上面RTP传输的例子,也同样使用vlc来播放,就可以实现网络摄像头。(哇塞,网络摄像头耶!远程监控耶!摄像头采集花了我两个月的时间吧,当时还年轻,后来发现是摄像头的问题,当然,这个也算是BUG,总结经验就是十几块的摄像头是靠不住的)

总结:上面有了摄像头采集保存的例子,有利用QT+GST实现播放器的例子,有RTP传输的例子,这样就可以实现用QT做界面,Gstreamer做后台的集采集编码保存,还有本地视频回放,网络视频监控于一体的DVR软件了。嗯,功能还挺全的。有意思吧~~

结束语:向以上几位哥们儿致敬。刚开始做民工,有你们的分享我很庆幸。

==========================================================================================

==================下边这个实在看不懂 留下研究=============================================

http://blog.csdn.net/wzwxiaozheng/archive/2011/01/12/6130818.aspx

在网上闲逛搜GST,不小心发现了一个网址

http://wiki.oz9aec.net/index.php/Gstreamer_cheat_sheet

是WIKI的GStreamer小抄,应该是这样翻译吧。

看了这个网址我就笑了。

上面讲了gstreamer字符叠加,画中画,屏墙等的实现,附带实现的命令,这样实现源码就小case了。

本文描述了gstreamer可实现的功能,主要是针对本硬盘录像机软件功能来说的,以gst-launch命令行的方式,简洁明了,并附有插图。大部分是网络资源,小部分是自己研究。难免有疏漏,敬请指正。

参考网址:

1,http://wiki.oz9aec.net/index.php/Gstreamer_cheat_sheet#Video_Wall:_Live_from_Pluto

,gstreamer实现摄像头采集 ,gstreamer实现视频显示 ,将4/3显示转换为16/9 ,实现h264编码并保存 ,将保存的视频播放,gstreamer实现视频截图 ,gstreamer实现字符叠加 ,gstreamer实现RTP网络服务端及客户端 ,gstreamer实现画中画,gstreamer实现屏墙效果

1,gstreamer实现摄像头采集:

gst-launch v4l2src ! xvimagesink   gst-launch v4l2src ! video/x-raw-yuv,width=320,height=240,framerate=20/1 ! xvimagesink(未通过)   gst-launch v4l2src ! video/x-raw-yuv,format=\(fourcc\)YUY2,width=320,height=240 ! xvimagesink (通过,)

2,gstreamer实现视频显示

gst-launch videotestsrc ! ximagesink (通过) 

  

3,gstreamer实现字符叠加

gst-launch videotestsrc ! timeoverlay ! xvimagesink (通过)   gst-launch -v videotestsrc ! video/x-raw-yuv, framerate=25/1, width=640, height=360 ! \    timeoverlay halign=left valign=bottom text="Stream time:" shaded-background=true ! xvimagesink (通过) 添加timeoverlay的效果,timeoverlay基于textoverlay 
  其它一些相关元件的使用: gst-launch videotestsrc ! cairotimeoverlay ! xvimagesink  (未通过) gst-launch videotestsrc ! clockoverlay ! xvimagesink (通过) gst-launch videotestsrc ! clockoverlay halign=right valign=bottom shaded-background=true time-format="%Y.%m.%D" ! ffmpegcolorspace ! ximagesink (通过) gst-launch -e v4l2src ! video/x-raw-yuv,format=\(fourcc\)YUY2,width=1280,height=720,framerate=5/1 ! \    ffmpegcolorspace ! \    timeoverlay halign=right valign=top ! clockoverlay halign=left valign=top time-format="%Y/%m/%d %H:%M:%S" ! \    tee name="splitter" ! queue ! xvimagesink sync=false splitter. ! \    queue ! videorate ! video/x-raw-yuv,framerate=1/1 ! \    theoraenc bitrate=256 ! oggmux ! filesink location=webcam.ogg (未通过) 

4,gstreamer实现RTP网络服务端及客户端

客户端: gst-launch -v gstrtpbin name=rtpbin latency=100 , udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, ssrc=(uint)340005641,clock-base=(uint)2625017333, payload=(int)96,  seqnum-base=(uint)5894" port=5000 ! queue ! rtpbin.recv_rtp_sink_0  rtpbin. ! rtph264depay ! queue ! ffdec_h264 ! videoscale ! autovideosink udpsrc port=5001 ! queue ! rtpbin.recv_rtcp_sink_0 rtpbin.send_rtcp_src_0 ! queue ! udpsink port=5005  sync=true  async=false (在windows底下成功,linux应该也没问题)   服务端: gst-launch -v  gstrtpbin name=rtpbin latency=100 \         uridecodebin uri=file:///home/miia/test.avi name=decoder \         decoder. ! tee name=tee0 \         tee0. ! queue2 ! ffmpegcolorspace ! videoscale ! autovideosink \         tee0. ! queue2 ! ffmpegcolorspace ! x264enc ! rtph264pay pt=96 ! queue2 ! rtpbin.send_rtp_sink_0 \         rtpbin.send_rtp_src_0 ! queue2 ! udpsink host=192.168.0.105 port=5000  async=false\         rtpbin.send_rtcp_src_0 ! queue2 ! udpsink host=192.168.0.105 port=5001 async=false\         udpsrc port=5005 ! queue2 ! rtpbin.recv_rtcp_sink_0 \          \         decoder. ! tee name=tee1 \         tee1. ! queue2 ! audioconvert ! autoaudiosink \         tee1. ! queue2 !  audioconvert ! faac !     rtpmp4apay pt=96 ! queue2 ! rtpbin.send_rtp_sink_1 \         rtpbin.send_rtp_src_1 ! queue2 ! udpsink host=192.168.0.105 port=5002  async=false\         rtpbin.send_rtcp_src_1 ! queue2 ! udpsink host=192.168.0.105 port=5003 async=false\         udpsrc port=5007 ! queue2 ! rtpbin.recv_rtcp_sink_1 (在linux底下成功)  
From man gst-launch: Network streaming       Stream video using RTP and network elements.       gst-launch v4l2src ! video/x-raw-yuv,width=128,height=96,format='(fourcc)'UYVY ! ffmpegcolorspace ! ffenc_h263       ! video/x-h263 ! rtph263ppay pt=96 ! udpsink host=192.168.1.1 port=5000 sync=false       Use this command on the receiver       gst-launch  udpsrc  port=5000 ! application/x-rtp, clock-rate=90000,payload=96 ! rtph263pdepay queue-delay=0 !       ffdec_h263 ! xvimagesink    

5,gstreamer实现视频截图

  gst-launch -e v4l2src ! video/x-raw-yuv,format=\(fourcc\)YUY2,width=1280,height=720,framerate=5/1 ! ffmpegcolorspace ! \    timeoverlay halign=right valign=bottom ! clockoverlay halign=left valign=bottom time-format="%Y/%m/%d %H:%M:%S" ! \    videorate ! video/x-raw-rgb,framerate=1/1 ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="frame%05d.png" (未通过) 

6,gstreamer实现画中画效果

gst-launch -e videotestsrc pattern="snow" ! video/x-raw-yuv, framerate=10/1, width=200, height=150 ! videomixer name=mix ! \    ffmpegcolorspace ! xvimagesink videotestsrc ! video/x-raw-yuv, framerate=10/1, width=640, height=360 ! mix. (通过,效果跟图片一样) 在一个窗口中同时显示两个视频界面 
  gst-launch videotestsrc pattern="snow" ! video/x-raw-yuv, framerate=10/1, width=200, height=150 ! \   videomixer name=mix sink_1::xpos=20 sink_1::ypos=20 sink_1::alpha=0.5 sink_1::zorder=3 sink_2::xpos=100 sink_2::ypos=100 sink_2::zorder=2 ! \    ffmpegcolorspace ! xvimagesink videotestsrc pattern=13 ! video/x-raw-yuv, framerate=10/1, width=200, height=150 ! mix. \    videotestsrc ! video/x-raw-yuv, framerate=10/1, width=640, height=360 ! mix. 设置视频界面的位置和效果,alpha透明效果 
gst-launch \    videomixer name=mix sink_1::xpos=20 sink_1::ypos=20 sink_1::alpha=0.5 sink_1::zorder=3 sink_2::xpos=100 sink_2::ypos=100 sink_2::zorder=2 ! \    ffmpegcolorspace ! xvimagesink \    videotestsrc ! video/x-raw-yuv, framerate=10/1, width=640, height=360 ! mix.sink_0 \    videotestsrc pattern="snow" ! video/x-raw-yuv, framerate=10/1, width=200, height=150 ! mix.sink_1 \    videotestsrc pattern=13 ! video/x-raw-yuv, framerate=10/1, width=200, height=150 ! mix.sink_2 (通过,效果非常好,跟图片一样) 
gst-launch -e videotestsrc pattern="snow" ! video/x-raw-yuv, framerate=10/1, width=200, height=150 ! videobox border-alpha=0 top=-20 left=-25 ! \    videomixer name=mix ! ffmpegcolorspace ! xvimagesink videotestsrc ! video/x-raw-yuv, framerate=10/1, width=640, height=360 ! mix.   Videobox的使用: 
  gst-launch -e videotestsrc pattern="snow" ! video/x-raw-yuv, framerate=10/1, width=200, height=150 ! \   videobox border-alpha=0 alpha=0.6 top=-20 left=-25 ! videomixer name=mix ! ffmpegcolorspace ! xvimagesink \   videotestsrc ! video/x-raw-yuv, framerate=10/1, width=640, height=360 ! mix. (通过) Videobox和alpha效果 
  gst-launch -e videotestsrc pattern="snow" ! video/x-raw-yuv, framerate=10/1, width=200, height=150 ! \   videobox border-alpha=1.0 top=-2 bottom=-2 left=-2 right=-2 ! videobox border-alpha=0 alpha=0.6 top=-20 left=-25 ! \    videomixer name=mix ! ffmpegcolorspace ! xvimagesink videotestsrc ! video/x-raw-yuv, framerate=10/1, width=640, height=360 ! mix. (通过,效果略有出入,不透明) border-alpha,加边框的透明效果 
  gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \    videotestsrc pattern=1 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! videobox border-alpha=0 top=0 left=0 ! mix. \    videotestsrc pattern=15 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! videobox border-alpha=0 top=0 left=-320 ! mix. \    videotestsrc pattern=13 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! videobox border-alpha=0 top=-180 left=0 ! mix. \    videotestsrc pattern=0 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! videobox border-alpha=0 top=-180 left=-320 ! mix. \    videotestsrc pattern=3 ! video/x-raw-yuv, framerate=5/1, width=640, height=360 ! mix. (通过) 

7,gstreamer实现屏墙效果

   gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \    videotestsrc pattern=0 ! video/x-raw-yuv, framerate=1/1, width=350, height=250 ! \      textoverlay font-desc="Sans 24" text="CAM1" valign=top halign=left shaded-background=true ! \      videobox border-alpha=0 top=-200 left=-50 ! mix. \    videotestsrc pattern="snow" ! video/x-raw-yuv, framerate=1/1, width=350, height=250 ! \      textoverlay font-desc="Sans 24" text="CAM2" valign=top halign=left shaded-background=true ! \      videobox border-alpha=0 top=-200 left=-450 ! mix. \    videotestsrc pattern=13 ! video/x-raw-yuv, framerate=1/1, width=350, height=250 ! \      textoverlay font-desc="Sans 24" text="CAM3" valign=top halign=left shaded-background=true ! \      videobox border-alpha=0 top=-200 left=-850 ! mix. \    multifilesrc location="pluto.jpg" caps="image/jpeg,framerate=1/1" ! jpegdec ! \     textoverlay font-desc="Sans 26" text="Live from Pluto" halign=left shaded-background=true auto-resize=false ! \      ffmpegcolorspace ! video/x-raw-yuv,format=\(fourcc\)AYUV ! mix. (修改几个参数后,通过,但效果不好,根据环境不同,所修改的参数不同。在本次试验中,把最后一行的format=\(fourcc\)AYUV去掉,则通过。本来应该显示三个画面,这次经验显示不全,不知道什么原因。不过经调试三个画面都显示了,但是,图片被黑框档掉一块儿,没有示例图片好看) 
  
可执行的命令行:(通过,需多次执行) gst-launch -e videomixer name=mix ! ffmpegcolorspace ! ximagesink \   videotestsrc pattern=0 ! video/x-raw-yuv, framerate=10/1, width=350, height=250 ! \      textoverlay font-desc="Sans 24" text="CAM1" valign=top halign=left shaded-background=true ! \      videobox border-alpha=0 top=-200 left=-850 ! mix. \    videotestsrc pattern="snow" ! video/x-raw-yuv, framerate=10/1, width=350, height=250 ! \      textoverlay font-desc="Sans 24" text="CAM2" valign=top halign=left shaded-background=true ! \     videobox border-alpha=0 top=-200 left=-450 ! mix. \    videotestsrc pattern=13 ! video/x-raw-yuv, framerate=10/1, width=350, height=250 ! \      textoverlay font-desc="Sans 24" text="CAM3" valign=top halign=left shaded-background=true ! \      videobox border-alpha=0 top=-200 left=-50 ! mix. \    multifilesrc location="pluto.jpg" caps="image/jpeg,framerate=10/1" ! jpegdec ! \      textoverlay font-desc="Sans 26" text="Live from Pluto" halign=left shaded-background=true auto-resize=false ! \      ffmpegcolorspace ! video/x-raw-yuv ! mix.

[转]GStreamer资料(摄像头采集,视频保存,远程监控)DVR的更多相关文章

  1. openwrt挂载摄像头及视频保存

    一.编译选项的选择: -> Utilities ->usbutils (这个里面包含lsusb的命令,是查看你的摄像头型号的) -> Kernel modules -> I2C ...

  2. 【ARM-Linux开发】Gstreamer+QT+摄像头 编程总结

    1,gstreamer开发手册,gstreamer官网(这些都不用说了吧) 2,gst-launch的用法,这也不用说了吧.(白菜,鸡蛋,西红柿,砖头,鼠标--..) 3,http://blog.ch ...

  3. Android中直播视频技术探究之---摄像头Camera视频源数据采集解析

    一.前言 在视频直播中一般都是两种视频数据源,一个是摄像头数据,一个是录制桌面数据,而一般来说美女妹子直播都是来自于摄像头数据,游戏直播都是录制桌面数据的,那么今天就来看看第一个数据源数据采集分析,A ...

  4. Android中直播视频技术探究之---采集摄像头Camera视频源数据进行推流(采用金山云SDK)

    一.前言 在之前已经详细介绍了Android中的一种视频数据源:Camera,不了解的同学可以点击进入:Android中Camera使用详解 ,在这篇文章中我们介绍了如何采集摄像头的每一帧数据,然后进 ...

  5. luvcview,使用mplayer查看摄像头和luvcview保存YUV图像视频的播放(转)

    luvcview,使用mplayer查看摄像头和luvcview保存YUV图像视频的播放 在mplayer中查看摄像头,可使用如下命令:mplayer tv:// -tv driver=v4l2:in ...

  6. Linux 下V4l2摄像头采集图片,实现yuyv转RGB,RGB转BMP,RGB伸缩,jpeglib 库实现压缩RGB到内存中,JPEG经UDP发送功(转)

    ./configure CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld --host=arm-linux --prefix=/usr/loca ...

  7. 基于opencv和mfc的摄像头采集代码(GOMFCTemplate2)

            编写带界面的图像处理程序,选择opencv+mfc是一种很好的选择:在读取摄像头数据方面,网上的方法很多,其中shiqiyu的camerads的方法是较好的.       基于现有资料 ...

  8. 基于opencv和mfc的摄像头采集代码(GOMFCTemplate2)持续更新

            编写带界面的图像处理程序,选择opencv+mfc是一种很好的选择:在读取摄像头数据方面,网上的方法很多,其中shiqiyu的camerads的方法是较好的.       基于现有资料 ...

  9. 利用ffmpeg一步一步编程实现摄像头采集编码推流直播系统

    了解过ffmpeg的人都知道,利用ffmpeg命令即可实现将电脑中摄像头的画面发布出去,例如发布为UDP,RTP,RTMP等,甚至可以发布为HLS,将m3u8文件和视频ts片段保存至Web服务器,普通 ...

随机推荐

  1. 【实用】如何在windows下快速截图?

    如何在windows下快速截图? 快速截图是很多人的需求.截图的工具和方案也很多,但是,这里给出一个通用的,被大众认为最高效的一个解决方案. 我们都知道键盘上有一个"prt sc" ...

  2. 在 RHEL/CentOS 7 上配置NTP时间服务器

    一.NTP简介 网络时间协议 - NTP - 是运行在传输层 123 号端口的 UDP 协议,它允许计算机通过网络同步准确时间.随着时间的流逝,计算机内部时间会出现漂移,这会导致时间不一致问题,尤其是 ...

  3. php 打印debug日志

    A lesser known trick is that mod_php maps stderr to the Apache log. And, there is a stream for that, ...

  4. 网易2016研发project师编程题

    http://www.nowcoder.com/test/970447/summary [编程题] 小易的升级之路 小易常常沉迷于网络游戏.有一次,他在玩一个打怪升级的游戏,他的角色的初始能力值为 a ...

  5. ERROR 1130: Host '' is not allowed to connect to thisMySQL server

    今天1网友求助,说自己PHPmyadmin能够正常连接数据库,使用sqlyog报错: ERROR 1130: Host '172.27.214.1' is not allowed to connect ...

  6. linux下软件的安装与卸载

    一 软件安装包的类型 通常Linux应用软件的安装有五种:    1) tar+ gz包,如software-1.2.3-1.tar.gz.他是使用UNIX系统的打包工具tar打包的.    2) r ...

  7. CAS 源码编译

    准备 :gradle   idea 第一次用Idea 还是有点不熟悉呀,还是eclipse 顺手! 哈哈 下载源码  :我的是4.2.7 解压 导入idea 重点: 调试时候在写 .没时间

  8. 前端发起resultUrl请求,服务端收到后做逆向处理,校验sign后,执行originUrl逻辑

    originUrl=http://test.com:8080/user/alipay_phone?uid=123&amount=21.3第0步:前后端约定32位密钥KEY第一步:对参数按照ke ...

  9. ECMAScript6箭头函数ArrowFunction"=>"

    一.说明 ECMAScript6可以用箭头"=>"定义函数.x => x * x或(x) => {return x * x;}与匿名函数function(x){r ...

  10. pmd 使用笔记

    pmd是一块开源的代码静态分析工具,使用java编写,可以自定义规则来进行自己想要的分析.pmd可以单独使用,也可以作为idea.eclipse的插件使用.它的规则分为xpath规则,和java规则. ...