Gstreamer 命令行

以下的命令行是经过自己测试使用,在此记录下以供后续查看;


混图-可设置第二个视频位置
gst-launch-1.0 \
  filesrc location=test2.3gp ! qtdemux ! queue ! h264parse ! avdec_h264 ! \
  videobox border-alpha=0 top=-70 bottom=-70 right=-220 ! \
  videomixer name=mix sink_0::alpha=0.7 sink_1::alpha=0.5 ! \
  videoconvert ! xvimagesink \
  filesrc location=1_2.mp4 ! qtdemux ! queue ! h264parse ! avdec_h264 ! \
  mix.

混图-不设置第二视频位置
gst-launch-1.0 \
  filesrc location=test2.3gp ! qtdemux ! queue ! h264parse ! avdec_h264 ! \
  videomixer name=mix sink_0::alpha=1 sink_1::alpha=0.5 ! \
  videoconvert ! xvimagesink \
  filesrc location=1_2.mp4 ! qtdemux ! queue ! h264parse ! avdec_h264 ! \
  mix.

混音
gst-launch-1.0 \
  filesrc location=1_2.mp4 ! qtdemux ! queue ! aacparse ! faad ! \
  adder name=mix ! \
  audioconvert ! audioresample ! pulsesink \
  filesrc location=RE5_20_jt.mp4 ! qtdemux ! queue ! aacparse ! faad ! audioconvert ! audioresample ! \
  mix.

音视频播放
gst-launch-1.0 \
  filesrc location=1_2.mp4 ! qtdemux name=qt \
  qt. ! queue ! h264parse ! avdec_h264 ! videoconvert ! xvimagesink \
  qt. ! queue ! aacparse ! faad ! audioconvert ! audioresample ! pulsesink 

两个音视频均混合
gst-launch-1.0 \
  filesrc location=zjl.mp4 ! qtdemux name=qt1 \
  qt1. ! queue ! h264parse ! avdec_h264 ! videomixer name=videomix sink_0::alpha=1 sink_1::alpha=0.8 sink_2::alpha=0.5 ! videoconvert ! xvimagesink \
  qt1. ! queue ! aacparse ! faad ! adder name=audiomix ! audioconvert ! audioresample ! pulsesink \
  filesrc location=1_2.mp4 ! qtdemux name=qt2 \
  qt2. ! queue ! h264parse ! avdec_h264 ! videomix. \
  qt2. ! queue ! aacparse ! faad ! audiomix. \


添加文字水印
gst-launch-1.0 videotestsrc ! videoconvert ! textoverlay text="Text Overlay " ! videoconvert ! xvimagesink
gst-launch-1.0 \
  filesrc location=1_2.mp4 ! qtdemux ! queue ! h264parse ! avdec_h264 ! \
  videomixer name=mix sink_0::alpha=1 sink_1::alpha=0.5 ! \
  opencvtextoverlay text="wonder.multimedia.best" xpos="0" ypos="100" colorR="255" colorG="255" colorB="255" ! videoconvert ! xvimagesink 

添加图片水印
gst-launch-1.0 filesrc location=sample.mp4 ! decodebin2 ! \
    videomixer name=mix ! xvimagesink filesrc location=watermark.png ! \
    pngdec ! imagefreeze ! ffmpegcolorspace ! mix.

存至本地
gst-launch-1.0 \
  filesrc location=1_2.mp4 ! qtdemux ! queue ! h264parse ! avdec_h264 ! \
  videomixer name=mix sink_0::alpha=1 sink_1::alpha=0.5 ! \
  textoverlay font-desc="Sans 20" text="多媒体部最牛X" valignment=top halignment=left ! \
  gdkpixbufoverlay location=smile.png overlay-height=100 overlay-width=100 offset-y=150 offset-x=500 ! videoconvert ! x264enc ! filesink location=1111.mp4

gst-launch-1.0 \
   videotestsrc pattern=0 ! \
   video/x-raw,format=AYUV,framerate= fraction 10/1,width=100,height=100 ! \
   videobox border-alpha=0 top=170 bottom=-70 right=-220 ! \
   videomixer name=mix sink_0::alpha=0.7 sink_1::alpha=0.5 ! \
   videoconvert ! xvimagesink \
   videotestsrc pattern=1 ! \
   video/x-raw,format=AYUV,framerate= fraction 5/1,width=320,height=240 ! mix.


后续命令是参考他人本人未测试过的:

1)  Record Sound on Android:

Android:

 * openslessrc ! audioconvert  ! audio/x-raw-int, channels=1, rate=16000 ! rtpL16pay ! udpsink host=10.10.10.100 port=5000* 

Receive:

*gst-launch-0.10 -v udpsrc port=5000 caps ="application/x-rtp, media=(string)audio, clock-rate=(int)16000, channels=(int)1,

payload=(int)96"  !   rtpL16depay ! audioconvert ! alsasink sync=false*

 

2)  Working on Ubuntu:

Server:

gst-launch-0.10 filesrc location=file.pcap ! pcapparse src-port=58694 ! application/x-rtp, payload=(int)96, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264  !  udpsink host=127.0.0.1 port=5000

Client :

gst-launch-0.10 udpsrc uri=udp://127.0.0.1:5000 ! application/x-rtp, payload=(int)96, media=(string)video, clock-rate=(int)90000,

encoding-name=(string)H264 ! gstrtpjitterbuffer latency=1000 , do-lost=true ! rtph264depay ! queue ! ffdec_h264 ! autovideosink

 

3) RTP h264 Sream:

gst-launch-1.0 -e rtspsrc location="rtsp://admin:12345@192.168.1.201:554//Streaming/Channels/1" !

rtph264depay ! h264parse ! matroskamux ! filesink location=foo1.mkv


4) Transmitting live audio over network using ogg Container:

Sending:

gst-launch -v autoaudiosrc ! audio/x-raw-int,channels=1,depth=16,width=16,rate=16000 ! volume volume=0.25 ! audioconvert  ! vorbisenc ! oggmux ! tcpserversink port=7821 

Receiving: 

gst-launch -v tcpclientsrc port=7821 ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink


5) Works well under Linux:

Server :

gst-launch-1.0 videotestsrc ! video/x-raw,format=RGB, width=320, height=240, framerate=30/1! videoconvert ! avenc_mpeg4 ! rtpmp4vpay config-interval=1 ! udpsink host=224.1.1.1 port=5004 auto-multicast=true 

Client :

gst-launch-1.0 udpsrc uri=udp://224.1.1.1:5004 caps="application/x-rtp, media=(string)video" ! rtpmp4vdepay ! avdec_mpeg4 ! videoconvert ! autovideosink -v 


6) With 1.2.4:

Server :

$ gst-launch-1.0 videotestsrc ! x264enc ! rtph264pay config-interval=10 pt=96 ! udpsink host=127.0.0.1 port=5001 &

Client :

 $ gst-launch-1.0 -v -e udpsrc address=127.0.0.1 port=5001 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000,

encoding-name=(string)H264' ! rtpjitterbuffer ! rtph264depay ! h264parse ! mp4mux ! filesink location=/tmp/rtp.mp4

 

7) Capture Video+Audio to a file:

$ gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-h264,width=1280,height=720,framerate=30/1 ! h264parse ! muxout. \pulsesrc device="alsa_input.usb-046d_HD_Pro_Webcam_C920_F1894590-02-C920.analog-stereo" ! queue ! audioconvert ! voaacenc bitrate=65536 ! muxout. matroskamux name=muxout streamable=true ! filesink location=muxed-AV.mp4

 

8) Change background in textoverlay:

$ gst-launch-0.10 videotestsrc ! video/x-raw-yuv, width=720, height=480 ! textoverlay text="<span foreground=\"blue\" background=\"green\" size=\"x-large\"> ...TEST... </span> is <i>cool</i>" ! xvimagesink


9) Add watermark in a video:

$ gst-launch-1.0 filesrc location=myvideo.mp4 ! decodebin ! videoconvert ! gdkpixbufoverlay location=logo.png !

videoconvert ! x264enc ! mp4mux ! filesink location=test.mp4

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
学习gstreamer命令可以帮助你在Linux系统中使用gstreamer架构进媒体开发。其中,gst-inspect和gst-launch是两个常用的工具。 gst-inspect用于查询库中各个插件element的详细信息。你可以使用以下命令来查询一个插件的信息: ``` gst-inspect <插件名> ``` 而gst-launch则用于在终端快速构建一条pipeline来播放多媒体。下面是一些常用的gst-launch命令示例: 1. 使用videotestsrc插件显示视频: ``` gst-launch-1.0 videotestsrc ! xvimagesink ``` 2. 使用filesrc插件播放本地视频文件: ``` gst-launch-1.0 filesrc location=<视频文件路径> ! decodebin ! autovideosink ``` 3. 使用udpsrc插件接收网络上的视频流: ``` gst-launch-1.0 udpsrc port=<端口号> caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! rtph264depay ! avdec_h264 ! autovideosink ``` 需要注意的是,以上命令中的插件和参数可以根据你的具体需求进调整。 此外,你还可以使用gst_parse_launch()这个API在应用程序中生成pipeline构件图。你可以参考以下链接了解如何生成构件图: ``` https://blog.csdn.net/u013554213/article/details/98078955 ``` 总结一下,学习gstreamer命令可以帮助你快速构建媒体播放和处理的pipeline。你可以使用gst-inspect查询插件信息,使用gst-launch构建pipeline,还可以使用gst_parse_launch()在应用程序中生成构件图。希望这些信息对你有帮助。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值