GStreamer
Multimedia-related commands
- Adjust the system volume (e.g., bind these to the volume-control keys on a keyboard):
amixer set Master 5%+ unmute; ogg123 /usr/share/sounds/freedesktop/stereo/bell.oga amixer set Master 5%- unmute; ogg123 /usr/share/sounds/freedesktop/stereo/bell.oga amixer set Master toggle; ogg123 /usr/share/sounds/freedesktop/stereo/bell.oga
- Record audio:
arecord -f S16_LE -c 2 output.wav
- Manipulate PulseAudio:
PULSE_RUNTIME_PATH=/var/run/user/UID/pulse pacmd ...
- Get the title of a DVD:
dvdbackup -i /dev/cdrom -I | head -n 1 | awk -F \" '{ print $2 }'
- Backup a DVD to an image file:
readom dev=/dev/cdrom f=output.iso
- Alternatively:
dvdbackup -i /dev/cdrom -M genisoimage -dvd-video -o output.iso /path/to/dvd/folder
Gst-launch examples
- Transcode to WebM/VP8/Vorbis and scale to 1280×720 (this format is often used with HTML5):
gst-launch-1.0 filesrc location=input.mts ! decodebin name=decoder \ webmmux name=mux ! filesink location=output.webm \ decoder. ! videoscale ! video/x-raw,width=1280,height=720 ! videoconvert ! vp8enc ! mux. \ decoder. ! progressreport ! audioconvert ! audiorate ! vorbisenc ! mux.
- Transcode to QuickTime/H.264 and scale to 1280×720 (this format is often used with HTML5, and it is—with the `profile=high` setting—suitable for Firefox and iOS/Safari):
gst-launch-1.0 filesrc location=input.mts ! decodebin name=decoder \ qtmux name=mux ! filesink location=output.mov \ decoder. ! videoscale ! video/x-raw,width=1280,height=720 ! videoconvert ! x264enc ! \ video/x-h264,profile=high ! mux. \ decoder. ! progressreport ! audioconvert ! audiorate ! avenc_aac ! mux.
- Transcode to Ogg/Theora/Vorbis and scale to 1280×720 (this format is sometimes used with HTML5 on open-source browsers):
gst-launch-1.0 filesrc location=input.mts ! decodebin name=decoder \ oggmux name=mux ! filesink location=output.ogg \ decoder. ! videoscale ! video/x-raw,width=1280,height=720 ! videoconvert ! theoraenc ! mux. \ decoder. ! progressreport ! audioconvert ! audiorate ! vorbisenc ! mux.
- Transcode to MPEG2 and scale to 1280×720:
gst-launch-1.0 filesrc location=input.mts ! decodebin name=decoder \ avmux_mpeg name=mux ! filesink location=output.mpg \ decoder. ! videoscale ! video/x-raw,width=1280,height=720 ! videoconvert ! avenc_mpeg2video ! mux. \ decoder. ! progressreport ! audioconvert ! audiorate ! lamemp3enc ! mux.
- Transcode title two from a DVD to the QuickTime format above:
gst-launch-1.0 dvdreadsrc title="2" device=/dev/cdrom ! decodebin name="decoder" \ qtmux name=mux ! filesink location=output.mov \ decoder. ! videoscale ! video/x-raw,width=720,height=480 ! videoconvert ! x264enc ! mux. \ decoder. ! progressreport ! audioconvert ! audiorate ! avenc_aac ! mux.
- Build a stop-motion video out of a series of images (the first command normalizes the images names—otherwise, there might be a missing number):
i=0; for f in *.JPG; do mv $f $i.JPG; i=$((i+1)); done
gst-launch-1.0 multifilesrc location=%d.JPG caps=“image/jpeg,framerate=(fraction)4/1”
! jpegdec ! videoscale ! video/x-raw,width=1280,height=720 ! videoconvert ! videorate ! theoraenc
! oggmux ! filesink location=output.ogg- Combine two videos to produce a blue/green-screen effect (here we specify the RGB values of the mask):
gst-launch-1.0 compositor name=mixer ! videoconvert ! xvimagesink \ filesrc location=background.mts ! decodebin ! alpha ! mixer.sink_0 \ filesrc location=foreground.mts ! decodebin \ ! alpha method=custom target-r=182 target-g=168 target-b=148 ! mixer.sink_1
- Determine the plugin graph produced by playbin:
GST_DEBUG_DUMP_DOT_DIR=/tmp/ gst-launch-1.0 playbin uri=file:///path dot -Tpng output.dot > graph.png
The first command will produce a number of GraphViz files which represent the pipelines produced by playbin. The most interesting of these is often the one that contains the string READY_PAUSED. The second command produces an image file which represents one of the pipelines.