gstreamer命令汇总

demo测试命令

gst-launch-1.0 videotestsrc ! autovideosink

 

测试文件下载地址:https://gstreamer.freedesktop.org/data/media/

转码一个文件

gst-launch-1.0 filesrc location=sintel_trailer-480p.webm ! matroskademux ! vp8dec ! x264enc ! matroskamux ! filesink location=out1.mkv

gst-launch-1.0 filesrc location=out1.mkv ! matroskademux ! h264parse ! openh264dec ! vp9enc ! matroskamux ! filesink location=vp9.mkv

gst-launch-1.0.exe filesrc location=out1.mkv ! matroskademux ! h264parse ! openh264dec ! videoconvert ! nvcudah265enc ! matroskamux ! filesink location=h265.mkv

gst-launch-1.0 filesrc location=pix.mp4 ! qtdemux name=de de.video_0 ! h264parse  ! openh264dec ! x264enc ! filesink location=x264.h264

播放一个文件

gst-play-1.0 out1.mkv

gst-launch-1.0 filesrc location=out1.mkv ! decodebin ! autovideosink

gst-launch-1.0 filesrc location=out1.mkv ! matroskademux ! h264parse ! openh264dec ! autovideosink

gst-launch-1.0 filesrc location=out1.mkv ! matroskademux name=demux demux.video_0 ! h264parse ! openh264dec ! autovideosink

gst-launch-1.0 filesrc location=pix.mp4 ! qtdemux name=de de.video_0 ! h264parse ! queue ! openh264dec ! queue ! autovideosink de.audio_0 ! queue ! aacparse ! avdec_aac ! audioconvert ! audioresample ! autoaudiosink

增加随机丢弃包率为10%

gst-launch-1.0  filesrc location=x264.h264 ! h264parse ! identity drop-probability=0.1 ! openh264dec ! queue ! autovideosink

裁剪videotestsrc,左边裁剪200,下面裁剪100

gst-launch-1.0 videotestsrc num-buffers=100 ! capsfilter caps=video/x-raw,format=NV12,width=800,height=600 ! videocrop left=200 bottom=100 ! autovideosink

混屏

gst-launch-1.0 videotestsrc ! "video/x-raw,format=(string)NV12,width=1280,height=720" ! tee name=testsrc ! queue ! compositor name=comp sink_1::width=200 sink_1::height=200 sink_1::xpos=80 sink_1::ypos=80 sink_1::alpha=0.55 sink_2::width=400 sink_2::height=300 sink_2::xpos=280 sink_2::ypos=260 sink_2::alpha=1 sink_3::width=180 sink_3::height=120 sink_3::xpos=380 sink_3::ypos=280 sink_3::alpha=0.8 sink_4::width=400 sink_4::height=320 sink_4::xpos=790 sink_4::ypos=60 sink_4::alpha=1 ! autovideosink testsrc. ! queue ! comp.sink_1 testsrc. ! queue ! comp.sink_2 testsrc. ! queue ! comp.sink_3 filesrc location=pix.mp4 ! qtdemux name=de de.video_0 ! h264parse ! queue ! openh264dec ! queue ! comp.sink_4

混音

gst-launch-1.0 audiotestsrc freq=100 ! audiomixer name=mix ! audioconvert ! alsasink audiotestsrc freq=500 ! mix.

 在视频上显示播放时间戳水印

gst-launch-1.0 videotestsrc pattern=smpte ! timeoverlay ! autovideosink

gst-launch-1.0 -v videotestsrc ! textoverlay text="Room A" valignment=top halignment=left font-desc="Sans, 72" ! autovideosink

显示一个字幕

gst-launch-1.0 -v filesrc location=subtitles.srt ! subparse ! txt.   videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! autovideosink

生成一张1080p中间带有你好文字的图片,文字使用微软雅黑,字体大小80,关闭文字大小自动调整才可以,否则会出现不是自己需要的样式

gst-launch-1.0 videotestsrc pattern=2 num-buffers=1 ! video/x-raw,width=1920,height=1080 ! videoconvert ! textoverlay text="你好" halignment=center valignment=center font-desc="微软雅黑,80" auto-resize=false ! jpegenc ! filesink location=t3.jpeg

添加图片水印

gst-launch-1.0 -v videotestsrc ! gdkpixbufoverlay location=t4.jpeg ! ximagesink

posted @ 2024-10-10 09:58  风吹大风车  阅读(27)  评论(0编辑  收藏  举报