分类: 嵌入式
2011-05-02 17:42:06
http://blog.youkuaiyun.com/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
1,gstreamer实现摄像头采集:
2,gstreamer实现视频显示
3,gstreamer实现字符叠加
其它一些相关元件的使用: 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网络服务端及客户端
5,gstreamer实现视频截图
6,gstreamer实现画中画效果
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 ! 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.