gstreamer(三) 常用命令集锦

在gstreamer开发中,关键是要知道命令行实现,如果命令验证没有问题,再将命令集成代码工程化,或者找找对应的API来实现。本文总结工作常用命令行实现(测试环境windows)。

1.YUV编码

gst-launch-1.0 filesrc location=/root/share/test.yuv blocksize=3110400 ! video/x-raw,format=I420, framerate=25/1,width=1920,height=1080,interlace-mode=progressive ! nvh264enc ! filesink location=nvenc.264

采用nvh2464编码器将一个1080P的YUV420p文件编成h264文件.

2.解码h264播放

自动探测解码器播放

gst-launch-1.0 filesrc location=D:\\videos\\20190302_0x70000000mux.h264 ! decodebin  ! d3dvideosink

指定解码器播放

gst-launch-1.0 filesrc location=D:\\videos\\20190302_0x70000000mux.h264 ! video/x-h264 ! h264parse !avdec_h264  ! d3dvideosink

3.解码h264写raw文件

写YUV

gst-launch-1.0 filesrc location=D:\\videos\\20190302_0x70000000mux.h264 ! video/x-h264 ! h264parse !avdec_h264  ! filesink  location=D:\\videos\\20190302_0x70000000mux.yuv

写RGB

gst-launch-1.0 filesrc location=D:\\videos\\20190302_0x70000000mux.h264 ! video/x-h264 ! h264parse !avdec_h264 !videoconvert !video/x-raw,format=BGRA  ! filesink  location=D:\\videos\\20190302_0x70000000mux.rgb

4.转码

gst-launch-1.0 filesrc location=D:\\videos\\test.h265 ! video/x-h265 ! h265parse !avdec_h265  !openh264enc  complexity=high bitrate=10000000 !filesink  location=D:\\videos\\test.h264

将h265转码成h264

5.播放MP4

1)万能播放器播放

gst-play-1.0.exe D:\\videos\\CCTV-2-dszg-1.mp4

2)自动插件播放

gst-launch-1.0 filesrc location=D:\\videos\\CCTV-2-dszg-1.mp4 ! qtdemux name=demux  demux.  ! queue ! decodebin  ! autovideosink  demux. ! queue  ! decodebin  ! audioconvert ! audioresample ! autoaudiosink

6 采集屏幕录像

采集并播放

gst-launch-1.0 dx9screencapsrc  ! d3dvideosink

采集并保存RGB文件

gst-launch-1.0 dx9screencapsrc  ! filesink  location=D:\\videos\\capture.bgr

采集并保存YUV文件

gst-launch-1.0 dx9screencapsrc !videoconvert !video/x-raw,format=I420 !filesink  location=D:\\videos\\capture.yuv

7.采集摄像头

gst-launch-1.0 ksvideosrc

devicepath="\\\\\?\\usb\#vid_04f2\&pid_b604\&mi_00\#6\&31e07f50\&0\&0000\#\{6994ad05-93ef-11d0-a3cc-00a0c9223196\}\\global"  ! d3dvideosink

Linux上采集设备为v4l2src

8.摄像头采集并RTP串流

gst-launch-1.0 wrappercamerabinsrc  !videoconvert !video/x-raw,format=I420 !openh264enc usage-type=camera complexity=high bitrate=10000000 ! rtph264pay  config-interval=3 ssrc=12345 !queue !udpsink host="127.0.0.1" port=60002

更多更详细请关注公众号:AV_Chat

  • 0
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

江海细流

如该文章对你有帮助,请支持!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值