gstreamer上的软件命令行指令
yuv文件转MP4文件:
gst-launch-1.0 filesrc location=new.yuv ! videoparse format=nv12 width=352 height=288 framerate=30/1 ! videoconvert ! x264enc ! h264parse ! mp4mux ! filesink location=newresult.mp4
MP4转换为yuv文件:
gst-launch-1.0 filesrc location=newresult.mp4 ! qtdemux ! h264parse ! avdec_h264 ! filesink location=newbus.yuv
YUV文件编码264
gst-launch-1.0 filesrc location=bus_cif.yuv ! videoparse format=nv12 width=352 height=288 framerate=30/1 ! videoconvert ! x264enc ! filesink location=result.264
264解码yuv文件
gst-launch-1.0 filesrc location=result.264 ! h264parse ! avdec_h264 ! filesink location=new.yuv
主要元件在于,264编码插件:x264enc 264解码插件:avdec_h264
gstreamer 推流相关指令:
摄像头推流到RTMP服务器,值得注意的是帧率设定因摄像而异
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,framerate=20/1 ! x264enc ! h264parse ! flvmux ! rtmpsink location='rtmp://172.18.0.1:1935/live'
本地视频RTMP推流
gst-launch-1.0 filesrc location=bus.mp4 ! qtdemux ! h264parse ! flvmux ! rtmpsink location='rtmp://172.18.0.1:1935/live'
gstreamer其他相关element
颜色转换:videoconvert
摄像头显示:
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,framerate=20/1 ! autovideosink
播放本地视频:
gst-launch-1.0 filesrc location=result.mp4 ! qtdemux ! avdec_h264 ! autovideosink