gstreamer常用的指令汇总
来源:互联网 发布:侠盗飞车3罪恶都市mac 编辑:程序博客网 时间:2024/04/30 17:01
Gstreamer中一些gst-launch常用命令
用Linux系统中使用gstreamer架构做对媒体开发时,gst-inspect和gst-launch是两个非常使用的小工具,gst-inspect 在开发时用于查询库各个插件element的详细信息,后者用于在终端快速构建一条pipeline用于播放多媒体。下面列出我在以前的学习和项目开发时常用的gst-launch播放各种多媒体文件的实例:
一、gstreamer实现视频显示
gst-launch videotestsrc ! xvimagesink
二、gstreamer实现摄像头采集:
1、可以现实图像,但图像卡住不动
gst-launch v4l2src ! xvimagesink
2、摄像头视频显示正常
gst-launch v4l2src !video/x-raw-yuv,format=fourccYUY2,width=640,height=480,framerate=15/1 !videorate ! videoscale ! ffmpegcolorspace ! xvimagesinkgst-launch v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=15/1 !queue2 ! videorate ! videoscale ! ffmpegcolorspace ! xvimagesink
三、摄像头视频现实及保存为avi格式文件
gst-launch -e v4l2src !video/x-raw-yuv,format=fourccYUY2,width=640,height=480,framerate=30/1 ! teename=srctee \srctee. ! queue2 name=squeue ! ffmpegcolorspace ! xvimagesink \srctee. ! queue2 name=fqueue ! videorate ! ffmpegcolorspace !ffenc_mpeg4 ! avimux ! filesink location=test.avi
四、将摄像头视频比例设置为16:9
gst-launch v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=15/1 !aspectratiocrop aspect-ratio=16/9 ! ffmpegcolorspace ! xvimagesink
五、保存摄像头的视频为avi格式
gst-launch -e v4l2src ! video/x-raw-yuv, format=fourccYUY2,framerate=30/1, width=640, height=480 ! videorate ! ffmpegcolorspace !ffenc_mpeg4 ! avimux ! filesink location=test.avi
六、多个流数据同时录制
gst-launch -e avimux name="muxer" ! filesink location=multi.avi\v4l2src ! video/x-raw-yuv, format=fourccYUY2, framerate=25/1,width=640, height=480 ! videorate ! ffmpegcolorspace ! ffenc_mpeg4 ! queue2 !muxer. \pulsesrc ! audioconvert ! audioresample! lamemp3enc target=1 bitrate=64cbr=true ! queue2 ! muxer.
七、画中画
1、videomixer可以将两个或多个视频流混合到一起:
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.
2、GstVideoMixerPad能够改变Z轴和图像的位置
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=20sink_1::alpha=0.5 sink_1::zorder=3 sink_2::xpos=100 sink_2::ypos=100sink_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.
3、GstVideoMixerPad可以制定每个sink
gst-launch \videomixer name=mix sink_1::xpos=20 sink_1::ypos=20sink_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
八、VideoBox可以用来制定视频框的大小和位置和apha混合透明度等
1、不透明
gst-launch -e videotestsrc pattern="snow" ! video/x-raw-yuv,framerate=10/1, width=200, height=150 ! videobox border-alpha=0 top=-100left=-100 ! \videomixer name=mix ! ffmpegcolorspace ! xvimagesink videotestsrc !video/x-raw-yuv, framerate=10/1, width=640, height=360 ! mix.
2、指定透明度
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.
3、添加边框
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 ! xvimagesinkvideotestsrc ! video/x-raw-yuv, framerate=10/1, width=640, height=360 ! mix.
九、VideoWall视频墙
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.
十、TextOverlay 在视频上面添加文本,由textoverlay插件实现,可以设置文本的属性
gst-launch videotestsrc !video/x-raw-yuv,width=640,height=480,framerate=15/1 ! textoverlaytext="Hello" ! ffmpegcolorspace ! ximagesink
十一、TimeOverlay ,由timeoverlay插件实现
1、由timeoverlay插件实现
gst-launch videotestsrc ! timeoverlay ! xvimagesinkgst-launch -v videotestsrc ! video/x-raw-yuv, framerate=25/1, width=640,height=360 ! \timeoverlay halign=left valign=bottom text="Streamtime:" shaded-background=true ! xvimagesink
2、cairotimeoverlay
gst-launch videotestsrc ! cairotimeoverlay ! ffmpegcolorspace ! xvimagesink
3、clockoverlay时钟
gst-launch videotestsrc ! cairotimeoverlay ! ffmpegcolorspace ! xvimagesinkgst-launch videotestsrc ! clockoverlay halign=right valign=bottomshaded-background=true time-format="%Y.%m.%D" ! ffmpegcolorspace !ximagesink
十二、录制视频为ogg格式,带时间和日期overlay
gst-launch -e v4l2src ! video/x-raw-yuv, format=fourccYUY2,framerate=20/1, width=640, height=480 ! \ffmpegcolorspace ! \timeoverlay halign=right valign=top ! clockoverlayhalign=left valign=top time-format="%Y/%m/%d %H:%M:%S" ! \tee name="splitter" ! queue2 ! xvimagesinksync=false splitter. ! \queue2 ! videorate ! ffmpegcolorspace ! theoraenc bitrate=256! oggmux ! filesink location=webcam.ogg
十三、视频墙
gst-launch videomixer name=mix sink_1::xpos=20 sink_1::ypos=20sink_1::alpha=1.0 sink_1::zorder=3 sink_2::xpos=40 sink_2::ypos=40sink_2::zorder=2 ! ffmpegcolorspace ! xvimagesink \uridecodebinuri=file:///mnt/hgfs/fedshare/source/video/loveStyle.mp4 ! ffmpegcolorspace !videoscale ! mix. \uridecodebin uri=file:///mnt/hgfs/fedshare/source/video/davincieffect_480p30.mp4! ffmpegcolorspace ! videoscale ! mix. \videotestsrc ! video/x-raw-yuv, framerate=10/1,width=800, height=540 ! mix.
十四、播放视频文件,带声音
gst-launch uridecodebinuri=file:///mnt/hgfs/fedshare/source/video/loveStyle.mp4 name=decoder \decoder. ! audioconvert ! autoaudiosink \decoder. ! ffmpegcolorspace ! xvimagesink
0 0
- gstreamer常用的指令汇总
- Linux常用的指令汇总
- 常用的git指令汇总
- LINUX下的常用指令汇总
- Ubuntu常用指令汇总
- 常用Linux指令汇总
- xshell-常用指令汇总 linux 常用指令
- 【GStreamer开发】GStreamer基础教程14——常用的element
- matlab常用基本指令汇总
- 个人常用centos指令汇总
- git基础常用指令汇总
- MongoDB数据库常用指令汇总
- iOS中 常用的mac终端指令汇总 技术分享
- iOS中 常用的mac终端指令汇总
- gstreamer的gst-launch常用插件
- mysql的指令汇总
- 7. GStreamer建议的学习步骤和网页链接汇总
- GStreamer建议的学习步骤和网页链接汇总
- 使用Octave音频处理(三):数学技术处理音频文件
- android用JSONObject和JSONArray解析json格式数据
- 转
- 最短路径四大算法核心Code
- 第五届蓝桥杯软件类省赛真题-JAVA-A-2_李白打酒
- gstreamer常用的指令汇总
- hdu 1698 Just a Hook
- 宏函数与自定义函数的区别与优缺点
- java synchronized 关键字(1)对象监视器为Object
- tomcat闪退
- Struts2.5使用通配符的方式实现动态方法调用报错
- java基础(二)-日期时间类
- (转)Android闪屏问题的分析思路
- 是否双引导 Linux 系统的理由