Skip to content

gstreamer tips

This is a placeholder page to share some of the things I learn about the excellent gstreamer framework, as I go along my journey playing with it. gst-inspect is a very important tool in understanding the source and sink pad capabilities and also to know the parameters associated with each element.

Play your UVC compliant webcam

# mdoprobe uvcvideo

# gst-launch-0.10 v4l2src ! ffmpegcolorspace ! ximagesink .

Get decoded YUV from MPEG2 TS file

$  gst-launch -v filesrc location=<input-filename>.ts ! flutsdemux ! mpeg2dec ! filesink location=<filename>.yuv

Scale YUV at one resolution to YUV of another (1080p to 720p scaling is shown)

$  gst-launch -v filesrc location=stream_1080p.yuv ! videoparse width=1920 height=1080 ! videoscale ! video/x-raw-yuv, width=1280, height=720 ! filesink location=stream_720p.yuv

Extract Audio encoded as AC3 from a TS file

$ gst-launch -v filesrc location=<filename>.ts ! flutsdemux ! ffdec_ac3 ! audio/x-raw-int, channels=2, width=16, rate=48000 ! wavenc ! filesink location=test.wav

Mux audio and video into an H.264/MP3 TS file

$  gst-launch -v flutsmux name=mux ! filesink location=test.ts filesrc location=stream_720p.yuv ! videoparse height=720 width=1280 framerate=24 ! x264enc key-int-max=1 bitrate=10000 ! mux. filesrc location=audio.wav ! wavparse ! lame ! mux.

Play AC3 file

$  gst-launch filesrc location=out.ac3 ! a52dec ! audioconvert !  audio/x-raw-int, channels=2, width=16, rate=48000 ! wavenc ! filesink location=audio.wav