Gstreamer常见pipeline命令

阅读: 评论:0

Gstreamer常见pipeline命令

Gstreamer常见pipeline命令

解码:(根据码流类型自适应创建相应解码器)

gst-launch-1.0 filesrc location=./home/user/DCIM/Camera/VID_v ! qtdemux ! droidvdec ! videoparse format=i420 width=1920 height=1080 framerate=30/1 ! filesink location=test_1920x1080.yuv

将720x1560@rgbx 转换为 1920x1080@I420:

gst-launch-1.0 filesrc location=./test_0323.yuv blocksize=4492800 ! videoparse format=rgbx width=720 height=1560 framerate=30/1 ! videoconvert ! "video/x-raw,format=I420,width=720,height=1560,framerate=30/1" ! videoscale ! "video/x-raw,format=I420,width=1920,height=1080,framerate=30/1" ! filesink location=./test_rgbxToI420.yuv

生成yuv:

gst-launch-1.0 -e videotestsrc ! "video/x-raw,format=I420,width=1920,height=1080,framerate=30/1" ! filesink location=./video_test_1920x1080.yuv

yuv查看:

gst-launch-1.0 filesrc location=./test_1920x1080.yuv blocksize=3110400 ! "video/x-raw, format=I420,width=1920,height=1080,framerate=30/1" ! videoparse format=i420 width=1920 height=1080 ! autovideosink

编码:

将YUV编码生成裸码流(H264):

gst-launch-1.0 filesrc location=test_1920x1080.yuv blocksize=3110400 ! "video/x-raw,format=I420,width=1920,height=1080,framerate=30/1" ! droidvenc ! "video/x-h264,stream-format=avc,alignment=au,width=1920,height=1080,framerate=30/1" ! h264parse ! "video/x-h264, stream-format=byte-stream" ! filesink location=test1.h264

将YUV编码生成avi文件(H264):

gst-launch-1.0 filesrc location=test_1920x1080.yuv blocksize=3110400 ! "video/x-raw,format=I420,width=1920,height=1080,framerate=30/1" ! droidvenc ! "video/x-h264,stream-format=avc,alignment=au,width=1920,height=1080,framerate=30/1" ! h264parse ! "video/x-h264, stream-format=byte-stream" ! avimux ! filesink location=./test1.avi

将YUV编码生成裸码流(H265):

gst-launch-1.0 filesrc location=test_1920x1080.yuv blocksize=3110400 ! "video/x-raw,format=I420,width=1920,height=1080,framerate=30/1" ! droidvenc ! "video/x-h265,stream-format=hvc1,alignment=au,width=1920,height=1080,framerate=30/1" ! h265parse ! "video/x-h265, stream-format=byte-stream" ! filesink location=test1.h265

将YUV编码生成MP4文件(H265):

gst-launch-1.0 filesrc location=test_1920x1080.yuv ! videoparse format=i420 width=1920 height=1080 framerate=30/1 ! droidvenc ! "video/x-h265,stream-format=hvc1,alignment=au,width=1920,height=1080,framerate=30/1" ! h265parse ! "video/x-h265, stream-format=hvc1" ! qtmux ! filesink location= test.mp4

生成avi

gst-launch-1.0 -e videotestsrc ! "video/x-raw,format=I420,width=320,height=240,framerate=30/1" ! avenc_mpeg4 ! mpeg4videoparse ! avmux_mp4 ! filesink location=./0523_test1.avi

gst-launch-1.0 -e videotestsrc ! "video/x-raw,format=I420,width=320,height=240,framerate=30/1" ! avenc_mpeg2video ! mpegvideoparse ! avmux_mpegts ! filesink location=./0523_test1.ts

编码生成ts文件(视频)

gst-launch-1.0 -e videotestsrc ! "video/x-raw,format=I420,width=320,height=240,framerate=30/1" ! droidvenc ! "video/x-h264,stream-format=avc,alignment=au,width=320,height=240,framerate=30/1" ! h264parse ! "video/x-h264, stream-format=byte-stream"! avmux_mpegts ! filesink location=./0523_test1.ts

编码生成ts文件(视频+音频)

gst-launch-1.0 -e videotestsrc ! "video/x-raw,format=I420,width=320,height=240,framerate=30/1" ! queue ! droidvenc ! "video/x-h264,stream-format=avc,alignment=au,width=320,height=240,framerate=30/1"

! h264parse ! "video/x-h264, stream-format=byte-stream"! mux. audiotestsrc ! avenc_aac ! queue ! mux. avmux_mpegts name=mux ! filesink location=./0523_test1.ts

camera:

将采集的yuv数据编码封装成avi文件:

gst-launch-1.0 droidcamsrc ! capsfilter ! "video/x-raw,format=NV21,width=1920,height=1080,framerate=30/1" ! videoparse format=i420 width=1920 height=1080 framerate=30/1 ! queue ! droidvenc ! "video/x-h264,stream-format=avc,alignment=au,width=1920,height=1080,framerate=30/1" ! h264parse ! "video/x-h264, stream-format=byte-stream" ! mux. pulsesrc !capsfilter ! "audio/x-raw,format=U8,channels=1,width=8,depth=8,rate=8000,signed=TRUE"! mux. avimux name=mux filesink location= test.avi

将采集的yuv数据编码封装成MP4文件:

gst-launch-1.0 -e droidcamsrc ! capsfilter ! "video/x-raw,format=NV21,width=1920,height=1080,framerate=30/1" ! videoparse format=i420 width=1920 height=1080 framerate=30/1 ! queue ! droidvenc ! "video/x-h264,stream-format=avc,alignment=au,width=1920,height=1080,framerate=30/1" ! h264parse ! "video/x-h264, stream-format=avc" ! mux. pulsesrc ! "audio/x-raw,format=U8,channels=1,width=8,depth=8,rate=8000,signed=TRUE" ! queue ! mux. qtmux name=mux ! filesink location= test.mp4

将采集的yuv数据编码封装成MP4文件(H265):

gst-launch-1.0 -e droidcamsrc ! capsfilter ! "video/x-raw,format=NV21,width=1920,height=1080,framerate=30/1" ! videoparse format=i420 width=1920 heig

ht=1080 framerate=30/1 ! queue ! droidvenc ! "video/x-h265,stream-format=hvc1,alignment=au,width=1920,height=1080,framerate=30/1" ! h265parse ! "video/x-h265, stream-fo

rmat=hvc1" ! mux. pulsesrc ! "audio/x-raw,format=U8,channels=1,width=8,depth=8,rate=8000,signed=TRUE" ! queue ! mux. qtmux name=mux ! filesink location= test.mp4

音频:

播放MP3音频文件

gst-launch-1.0 filesrc location=./so/video/Test_videos_and_audios/Test_audio/daoxiang.mp3 ! decodebin ! pulsesink

gst-launch-1.0 filesrc location=./so/video/Test_videos_and_audios/Test_audio/daoxiang.mp3 ! mpegaudioparse ! avdec_mp3 ! autoaudiosink

编码生成音频文件

gst-launch-1.0 -e pulsesrc ! wavenc ! queue ! filesink location=test.wav

播放包含原始音频数据 (PCM) 的 .WAV 文件

gst-launch-1.0 filesrc location=test.wav ! wavparse ! audioconvert ! audioresample ! autoaudiosink

将pcm编码成aac文件

gst-launch-1.0 -e audiotestsrc ! audio/x-raw, channels=2, rate=44100, format=S16LE, layout=interleaved ! queue ! audiorate ! audioconvert ! avenc_aac ! qtmux ! filesink location=/home/user/test.aac

RTP(video)

gst-launch-1.0 -e videotestsrc ! "video/x-raw,format=I420,width=320,height=240,framerate=30/1" ! droidvenc ! "video/x-h264,stream-format=avc,alignment=au,width=320,height=240,framerate=30/1" ! h264p

arse ! "video/x-h264, stream-format=byte-stream" ! avmux_mpegts ! "video/mpegts,systemstream=true" ! rtpmp2tpay ! udpsink name=sink host=172.16.23.27 port=7236

gst-launch-1.0 -e videotestsrc ! "video/x-raw,format=I420,width=320,height=240,framerate=30/1" ! avenc_mpeg2video ! mpegvideoparse ! avmux_mpegts ! "video/mpegts,systemstream=true" ! rtpmp2tpay ! udpsink name=sink host=172.16.23.27 port=7236

RTP(video + audio)

gst-launch-1.0 -e videotestsrc ! "video/x-raw,format=I420,width=320,height=240,framerate=30/1" ! queue ! droidvenc ! "video/x-h264,stream-format=avc,alignment=au,width=320,height=240,framerate=30/1"

! h264parse ! "video/x-h264, stream-format=byte-stream"! mux. audiotestsrc ! avenc_aac ! queue ! mux. avmux_mpegts name=mux ! "video/mpegts,systemstream=true" ! rtpmp2tpay ! udpsink name=sink host=172.16.23.27 port=7236

//相机最终推流效果
gst-launch-1.0 rtpsession name=rtpsess droidcamsrc ! capsfilter ! video/x-raw,format=NV21,width=1920,height=1080,framerate=30/1 ! videoparse format=i420 width=1920 height=1080 framerate=30/1 ! droidvenc target-bitrate=3000000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! video/x-h264, stream-format=byte-stream, alignment=au ! mpegtsmux ! rtpmp2tpay ! v_rtp_v_rtp_src ! queue ! udpsink host=172.16.200.73 port=8554 async=false sync=false
//视频最终推流效果-软编方式
gst-launch-1.0 rtpsession name=rtpsess filesrc location=/data/test_1280x720.yuv blocksize=1382400 ! videoparse format=i420 width=1280 height=720 framerate=25/1 ! timeoverlay ! x264enc bitrate=1024 speed-preset=3 ! video/x-h264, profile=baseline ! mpegtsmux ! rtpmp2tpay ! v_rtp_v_rtp_src ! queue ! udpsink render-delay=1000 host=172.16.200.73 port=8554
//视频最终推流效果-硬编方式
gst-launch-1.0 rtpsession name=rtpsess filesrc location=/data/test_1280x720.yuv blocksize=1382400 ! videoparse format=i420 width=1280 height=720 framerate=25/1 ! timeoverlay ! droidvenc target-bitrate=2048000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! video/x-h264, stream-format=byte-stream, alignment=au ! mpegtsmux ! rtpmp2tpay ! v_rtp_v_rtp_src ! queue ! udpsink render-delay=1000 host=172.16.200.73 port=8554
//视频最终推流效果-硬编方式(不带session)
gst-launch-1.0 filesrc location=/data/test_1280x720.yuv blocksize=1382400 ! videoparse format=i420 width=1280 height=720 framerate=25/1 ! timeoverlay ! droidvenc target-bitrate=2048000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink render-delay=1000 host=172.16.200.73 port=8554


//单独传流
gst-launch-1.0 videotestsrc ! videoconvert ! video/x-raw,format=I420,width=1280,height=720,framerate=25/1 ! droidvenc target-bitrate=2048000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! video/x-h264,stream-format=byte-stream,alignment=au ! mpegtsmux ! rtpmp2tpay ! udpsink render-delay=1000 host=172.16.200.73 port=8554
//单独生成视频文件
gst-launch-1.0 videotestsrc ! videoconvert ! video/x-raw,format=I420,width=1280,height=720,framerate=25/1 ! droidvenc target-bitrate=2048000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! video/x-h264,stream-format=byte-stream,alignment=au ! avimux ! filesink location=./test1.avi
//传流+生成视频文件
gst-launch-1.0 videotestsrc ! videoconvert ! video/x-raw,format=I420,width=1280,height=720,framerate=25/1 ! tee name=t ! queue ! droidvenc target-bitrate=2048000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! video/x-h264,stream-format=byte-stream,alignment=au ! mpegtsmux ! rtpmp2tpay ! udpsink render-delay=1000 host=172.16.200.73 port=8554 t. ! queue ! droidvenc target-bitrate=2048000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! video/x-h264,stream-format=byte-stream,alignment=au ! avimux ! filesink location=./test1.avi
//传流+显示视频流
gst-launch-1.0 filesrc location=/data/test_1280x720.yuv blocksize=1382400 ! videoparse format=i420 width=1280 height=720 framerate=25/1 ! timeoverlay ! tee name=t ! queue ! droidvenc target-bitrate=2048000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink render-delay=1000 host=172.16.200.73 port=8554 t. ! queue ! droidvenc target-bitrate=2048000 ! video/x-h264,stream-format=avc,alignment=au ! h264parse ! droidvdec ! videoparse format=i420 width=1280 height=720 framerate=25/1 ! videoconvert name=conv + sink

本文发布于:2024-02-05 01:09:20,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170720605961675.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:命令   常见   Gstreamer   pipeline
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23