以下的命令行是经过自己测试使用,在此记录下以供后续查看;
混图-可设置第二个视频位置
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:[email protected]: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=" ...TEST... is cool" ! 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