命令行調試日誌:ios
--gst-debug-level=X 或 --gst-debug=myelement:X(X的取值爲[0,5])app
Udpsrcide
Sender:spa
./gst-launch-1.0 videotestsrc is-live=true ! video/x-raw,framerate=25/1 ! videoconvert ! x264enc ! h264parse ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=5000命令行
Receiver:debug
/gst-launch-1.0 -v udpsrc port=5000 ! application/x-rtp,clock-rate=90000,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! glimagesink
調試
採集攝像頭:日誌
./gst-launch-1.0 -v -m autovideosrc ! videoconvert ! osxvideosinkcode
採集麥克風 pcmuorm
./gst-launch-1.0 autoaudiosrc ! audioconvert ! audioresample ! mulawenc ! rtppcmupay ! udpsink host=127.0.0.1 port=8888
接收:
/gst-launch-1.0 -ve udpsrc port=10002 ! application/x-rtp, clock-rate=8000, payload=0 ! rtppcmudepay ! mulawdec ! audio/x-raw, format=S16LE, layout=interleaved, rate=8000 ! audioconvert ! audiomixer name=mix ! audioconvert ! audioresample ! autoaudiosink
#opus
./gst-launch-1.0 autoaudiosrc ! audioconvert ! audioresample ! opusenc ! rtpopuspay pt=127 ! udpsink host=127.0.0.1 port=10001
混流demo:
./gst-launch-1.0 intervideosrc ! video/x-raw,framerate=\(fraction\)10/1,width=3200,height=2400 ! videomixer name=mix sink_2::xpos=1000 sink_2::width=140 sink_2::height=140 sink_1:xpos=0 ! videoconvert ! glimagesink filesrc location=./ttt.mov ! decodebin ! video/x-raw,width=1280,height=720 ! mix. videotestsrc ! video/x-raw,framerate=\(fraction\)10/1 ! mix.
./gst-launch-1.0 intervideosrc channel=aaaa ! video/x-raw,framerate=\(fraction\)10/1,width=320,height=240 ! videomixer name=mix background=2 sink_1::alpha=1 sink_1::xpos=400 sink_2::zorder=0 sink_3::zorder=1 ! video/x-raw, width=1280, height=720 ! clockoverlay ! videoconvert ! glimagesink videotestsrc ! video/x-raw,format=AYUV,framerate=\(fraction\)5/1,width=1280,height=720 ! videobox left=-10 ! videoscale ! video/x-raw, width=320,height=180 ! mix. videotestsrc ! videobox border-alpha=1 bottom=-5 ! mix. filesrc location=./bule.jpg ! jpegdec ! videoscale ! video/x-raw,width=320,height=240 ! imagefreeze ! mix.
./gst-launch-1.0 intervideosrc ! video/x-raw,framerate=\(fraction\)10/1,width=320,height=240 ! videomixer name=mix sink_0::alpha=1 sink_1::alpha=1 sink_1::xpos=100 ! videoconvert ! glimagesink videotestsrc ! video/x-raw,format=AYUV,framerate=\(fraction\)5/1,width=120,height=100 ! videocrop ! mix. videotestsrc ! mix.
兩路mix:
./gst-launch-1.0 intervideosrc ! video/x-raw,framerate=\(fraction\)10/1,width=320,height=240 ! videomixer name=mix sink_0::alpha=1 sink_1::alpha=1 sink_1::xpos=100 sink_2::ypos=100 ! videoconvert ! glimagesink videotestsrc ! video/x-raw,format=AYUV,framerate=\(fraction\)5/1,width=120,height=100 ! videobox border-alpha=0 top=70 bottom=70 right=22 ! mix. videotestsrc ! video/x-raw, format=AYUV, width=100, height=100 ! mix.
/gst-launch-1.0 intervideosrc ! video/x-raw,framerate=\(fraction\)10/1,width=3200,height=2400 ! videomixer name=mix sink_1::xpos=200 sink_2:xpos=0 ! videoconvert ! glimagesink filesrc location=./ttt.mov ! decodebin ! video/x-raw,width=1280,height=720 ! videocrop left=100 top=200 ! mix. videotestsrc ! video/x-raw,framerate=\(fraction\)10/1 ! mix.
/gst-launch-1.0 intervideosrc ! video/x-raw,framerate=\(fraction\)10/1,width=3200,height=2400 ! videomixer name=mix sink_1::xpos=200 sink_2::xpos=1000 sink_2::width=100 sink_2::height=100 ! videoconvert ! glimagesink filesrc location=./ttt.mov ! decodebin ! video/x-raw,width=1280,height=720 ! mix. videotestsrc ! video/x-raw,framerate=\(fraction\)10/1 ! mix.
//混流+縮放
./gst-launch-1.0 intervideosrc ! video/x-raw,framerate=\(fraction\)10/1,width=3200,height=2400 ! videomixer name=mix sink_1::xpos=0 sink_2::xpos=1000 sink_2::width=100 sink_2::height=100 ! videoconvert ! glimagesink filesrc location=./ttt.mov ! decodebin ! video/x-raw,width=1280,height=720 ! videoscale ! video/x-raw,width=100 ! mix. videotestsrc ! video/x-raw ! mix.
udpsink:
./gst-launch-1.0 videotestsrc is-live=true ! video/x-raw,framerate=25/1 ! videoconvert ! x264enc ! h264parse ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=8888 audiotestsrc is-live=1 ! mulawenc ! rtppcmupay ! application/x-rtp, media=audio, payload=0, rate=8000 ! udpsink host=127.0.0.1 port=8888
gst-launch-1.0 -v udpsrc port=5000 ! application/x-rtp,clock-rate=90000,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! osxvideosink
./gst-launch-1.0 udpsrc port=8888 ! "application/x-rtp, media=video, clock-rate=90000, encoding-name=H264" ! rtph264depay ! avdec_h264 ! videoconvert ! glimagesink
./gst-launch-1.0 -e -v udpsrc port=10001 ! "application/x-rtp, media=video, clock-rate=90000, encoding-name=H264" ! rtph264depay ! h264parse ! "video/x-h264, stream-format=byte-stream" ! filesink location=./aa.h264
gst-launch-1.0 rtpmux name=mux ! udpsink host=127.0.0.1 port=8888 \
audiotestsrc ! alawenc ! rtppcmapay ! \
application/x-rtp, payload=8, rate=8000 ! mux.sink_0 \
audiotestsrc is-live=1 ! \
mulawenc ! rtppcmupay ! \
application/x-rtp, payload=0, rate=8000 ! mux.sink_1
發送視頻:
./gst-launch-1.0 videotestsrc is-live=true ! video/x-raw,framerate=25/1 ! videoconvert ! x264enc ! h264parse ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=8888
發送音頻:
./gst-launch-1.0 audiotestsrc is-live=1 ! mulawenc ! rtppcmupay ! udpsink host=127.0.0.1 port=8888
播放並存儲爲h264
gst-launch-1.0 -e -v udpsrc port=10001 ! "application/x-rtp, media=video, clock-rate=90000, encoding-name=H264" ! rtph264depay ! tee name=t t. ! queue ! h264parse ! "video/x-h264, stream-format=byte-stream" ! filesink location=./aa.h264 t. ! queue ! avdec_h264 ! glimagesink
播放h264
./gst-launch-1.0 filesrc location=/Users/aa/Desktop/ttt.h264 ! h264parse ! openh264dec ! glimagesink
存儲每幀圖片:
./gst-launch-1.0 videotestsrc ! videoconvert ! video/x-raw,framerate=30/1 ! queue ! pngenc ! multifilesink location="frame%d.png"