gstreamer 调试相关命令

本文介绍在Ubuntu22.04系统中安装GStreamer的方法及一系列测试指令,包括视频测试源、网络摄像头测试、分辨率调整、H.264解码及视频录制等操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hi all,

运行环境:ubuntu22.04LTS,VMware 16 pro

安装gstreamer:

Installing on Linux

sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

However I found that  gstreamer1.0-doc is not included, so I skipped this and haven't met errors. If anyone find errors or some other situations feel free to contact me.

open terminal, remember to add remove device webcam when using v4l2src. 

1.测试视频:

gst-launch-1.0 videotestsrc! videoconvert ! autovideosink

gst-launch-1.0 videotestsrc! videoconvert ! xvimagesink

gst-launch-1.0 videotestsrc! videoconvert ! waylandsink

remember that xvimagesink/ximagesink run on x11 server, and waylandsink run on wayland/weston. The way to change ubuntu 22.04 from x11 to wayland:

https://linuxconfig.org/how-to-enable-disable-wayland-on-ubuntu-22-04-desktop

2.测试webcam:

gst-launch-1.0 v4l2src ! videoconvert ! autovideosink

gst-launch-1.0 v4l2src ! videoconvert ! xvimagesink

gst-launch-1.0 v4l2src ! videoconvert ! waylandsink

3. change resolution:

gst-launch-1.0 v4l2src ! videoscale ! video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert !  xvimagesink

4: h264 decode

gst-launch-1.0 v4l2src ! video/x-h264-raw ! h264parse ! avdec_h264 ! videoconvert ! xvimagesink

5: record

gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=30 !  videoconvert ! 'video/x-raw, width=640, height=480, framerate=30/1' ! x264enc ! mp4mux ! filesink sync=false location=camera-h264-640x480.mp4

num-buffers means the pipeline will only run 30 frames, and break out immediately. In another way, this example set the video in 30 fps, so the record video will only last 30/30=1 second. If you wish to quit before dealine, type ctrl^c in terminal.

That's the end of today's sharing

2022/11/21 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值