Useful Gstreamer Commands

Version 2
Visibility: Open to anyone



    Introduction


    Sometimes you only want to play a video the easiest way.


    Play Everything Everywhere Anytime


    It´s not the better perfomance decoder, but it´s the easiest way to play any unknown file. And you can use it on verbose mode to figure out which decoder and demuxer to use.


    Playbin

     

    gst-launch playbin2 uri=file:///home/movies/my_favorite.movie

     

    Or, use the verbose command line:

     

    gst-launch -v --gst-debug=2 playbin2 uri=file:///home/movies/my_favorite.movie

     

    Decodebin

     

    gst-launch filesrc location=/home/movies/my_favorite.movie ! decodebin name=demux demux. ! autovideosink demux. !  autoaudiosink

     

    gst-launch -v --gst-debug=2 filesrc location=/home/movies/my_favorite.movie ! decodebin name=demux demux. ! autovideosink demux. !  autoaudiosink

     

    How to encode audio

     

    Encoding MP3

     

    gst-launch alsasrc ! mfw_mp3encoder ! filesink location= audio.mp3

     

    Encoding an AVI Audio Only

     

    gst-launch alsasrc ! mfw_mp3encoder ! avimux ! filesink location=audio.avi    

     

    gst-launch audiotestsrc ! mfw_mp3encoder ! avimux ! filesink location=audio.avi   

     

    Encoding Audio and Video

    Raw Video and Raw Audio

     

    gst-launch videotestsrc num-buffers=250 ! 'video/x-raw-yuv,format=(fourcc)I420,width=320,height=240,framerate=(fraction)25/1' ! queue ! mux. audiotestsrc num-buffers=440 ! audioconvert ! 'audio/x-raw-int,rate=44100,channels=2' ! queue ! mux. avimux name=mux ! filesink location=test.avi

     

    H.263 Video and Raw Audio

     

    gst-launch videotestsrc num-buffers=250 ! mfw_vpuencoder codec-type=1 ! queue ! mux. audiotestsrc num-buffers=440 ! audioconvert ! 'audio/x-raw-int,rate=44100,channels=2' ! queue ! mux. avimux name=mux ! filesink location=test.avi

     

    H.263 Video and MP3 Audio From Test Source

     

    gst-launch videotestsrc num-buffers=250 ! mfw_vpuencoder codec-type=1 ! queue ! mux. audiotestsrc num-buffers=440 ! audioconvert ! mfw_mp3encoder ! queue ! mux. avimux name=mux ! filesink location=test.avi

     

    H.263 Video and MP3 Audio From Real Source

     

    gst-launch-0.10 mfw_v4lsrc capture-mode=5 num-buffers=300 capture-width=320 capture-height=240 fps-n=15 blocksize=115200 ! queue2 max-size-buffers=1000 max-size-bytes=0 max-size-time=0 ! mfw_vpuencoder framerate=15 codec-type=2 name=venc  alsasrc num-buffers=300 ! audio/x-raw-int,rate=32000,channels=1,depth=16 ! audioconvert ! queue2 max-size-buffers=1000 max-size-bytes=0 max-size-time=0 ! mfw_mp3encoder name=aenc avimux name=mux ! filesink location=all_in_one.avi aenc. ! mux. venc. ! mux.

     

    Reference

    http://blog.buberel.org/2008/03/using-a-usb-web.html