您的位置:首页 > 其它

Gstreamer/tools: gst-launch gst-inspect 用法示例

2015-06-19 11:20 295 查看
1. 查看 gst 中的 plugins 及其详细信息:

$ gst-inspect

列出 gstreamer 中所有的 plugins

$ gst-inspect alsasink

打印出 alsasink 的详细信息

$ gst-inspect --gst-debug all

打印出 GST_DEBUG 环境变量所有可用的值

2. 利用 gst 中的 playbin 来播放音视频

$ gst-launch playbin uri=file:///<audio or video file>

3. 使用 gst 中提供的 elements 自己创建 pipeline 来播放多媒体资源

1) 播放 audio 文件

$ gst-launch filesrc location=1.m4a ! qtdemux ! queue !
ffdec_aac ! audioflingersink

$ gst-launch filesrc location=2.mp3 ! mp3parse ! mad ! audioconvert ! audioflingersink

$ gst-launch filesrc location=48khz.wav ! wavparse ! audioconvert ! audioresample
quality=0 ! audio/x-raw,rate=4000 ! alsasink

$ gst-launch filesrc location=my.mpeg ! decodebin ! pulsesink // Automatically detect the right audio codec in a pipeline

2) 播放 video 文件

$ gst-launch filesrc location=1.3gp ! qtdemux ! queue !
ffdec_h263 ! ffmpegcolorspace ! urfaceflingersink

$ gst-launch filesrc location=my.mpeg ! decodebin ! videoconvert ! xvimagesink // Automatically detect the right video
codec in a pipeline

3) 播放 audio + video 文件

$ gst-launch filesrc location=1.mp4 !qtdemux
name=demux

demux. ! queue
! ffdec_aac ! audioflingersink

demux. ! queue ! ffdec_aac ! audioflingersink

$ gst-launch filesrc location=my-random-media-file.mpeg ! decodebin name=decoder

decoder. ! videoconvert ! xvimagesink

decoder. ! audioconvert ! pulsesink

4. 使用 gst 中提供的 elements 自己创建 pipeline 来录制多媒体资源

1) default audio source is Microphone
$ gst-launch autoaudiosrc ! audioconvert ! faac ! mp4mux ! filesink location=aac_audio.mp4
2) Having multiple audio sources and mic is not default audio source, then you have to specify device identifier of the mic input.
$ gst-launch alsa-src device=<device identifier for mic input> ! audioconvert ! faac ! mp4mux
! filesink location=aac_audio.mp4
$ gst-launch oss-src device=<device identifier for mic input> ! audioconvert ! faac ! mp4mux !

5. 使用 gst dump 出 wav 格式音频
1) Using uridecodebin
$ gst-launch-1.0 uridecodebin uri=file:///aac_5.1.m4a ! wavenc !
filesink location=/aac_5.1.m4a.wav

6. 使用 gst dump 出 pipeline 构成图
首先创建用于存放数据的目录: ./dot
$ GST_DEBUG_DUMP_DOT_DIR=./dot gst-launch-1.0 playbin uri=file:///mnt/share/audio_test_file/ape/stereo/APE_48khz_16bit_stereo_extrahigh.ape
$ cd ./dot

$ dot -Tpng 0.00.00.170426473-gst-launch.PAUSED_PLAYING.dot > pipeline.png

持续更新中...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: