Recording only one window in Gnomes 3 default desktop recorder
Gnome 3 has great feature under Ctrl-Alt-Shift-R shortcut1. I guess this is Istanbul. It appears that it's not istanbul... Yet I can't find any info about this program.
Where can I find man page? How can I run it from console?
And most importantly: How can I record only one window (similar to Alt+Print Screen)?
According to GNOME API doc, the gnome-shell (shell-recorder class) screen recorder is basically pipeline all screenshot output to a pipeline which is then encoded by GStreamer.
You can use your dconf-editor application and navigate to org.gnome.shell.recorder
, in this schema you will find 3 options:
- file-extension - default on my box to
webm
- framerate - defauly on my box to 30
- pipeline - which default to pipeline to GStreamer vp8enc for encoding the stream.
vp8enc min_quantizer=13 max_quantizer=13 cpu-used=5 deadline=1000000 threads=%T ! queue ! webmmux
So how could we replicate the recording pipeline on command line? We could do so with the gstreamer-tool's gst-launch command. Firstly, you need to install gst-tools on your box and you can start playing with gstreamer!. Here are few examples:
Record to webm (vp8 video & vorbis audio):
gst-launch ximagesrc ! ffmpegcolorspace ! queue ! vp8enc quality=10 speed=2 ! mux. alsasrc ! audio/x-raw-int ! queue ! audioconvert ! vorbisenc ! mux. webmmux name=mux ! filesink location=screencast.webm
Press Ctrl+C to stop the recording.
Record to ogv (theora video & vorbis audio):
gst-launch ximagesrc ! ffmpegcolorspace ! queue ! theoraenc ! mux. alsasrc ! audio/x-raw-int ! queue ! audioconvert ! vorbisenc ! mux. oggmux name=mux ! filesink location=screencast.ogv
Press Ctrl+C to stop the recording.
The pipelines are executed by gst-launch. Here's what they do:
- Grab the X video image (the desktop)
- Automatically convert the video to an acceptable format
- Spawn a background thread [t1] to continue video processing
- [t1] Encode the video (either to vp8 or theora)
- [t1] Prep for merging the video into the video shell (webm or ogg)
- Grab the audio input as raw (the microphone)
- Spawn a background thread [t2] to continue audio processing
- [t2] Automatically convert the audio to an acceptable format
- [t2] Encode the audio to vorbis
- [t2] Prep for merging the audio into the video shell (webm or ogg)
- Write encoded audio and video into the video file
Now, you don't have to be scared of gstreamer pipelines anymore! \o/
And most importantly. How can I record only one window?
If you can get the XID of the window, you can pass it to ximagesrc. E.g., if you know what the unique title of the Window is, you can use xwininfo and a little magic to get that. In bash:
TITLE="Terminal Six"
WINDOW_XID=$(xwininfo -tree -root -all | egrep $TITLE | sed -e 's/^ *//' | cut -d\ -f1)`
Now you can just pass that XID to ximagesrc, and of course, finish out the pipeline:
gst-launch-1.0 ximagesrc xid=$WINDOW_XID ! video/x-raw,framerate=30/1 ! videoconvert ! queue ! ...
And FYI, I'm showing you this using the 1.0 version of gstreamer. There is no more ffmpegcolorspace, you use videoconvert instead (latest versions of FFmpeg have had a name change to 'libav' so it's been renamed).