Skip to content

Instantly share code, notes, and snippets.

@ShannonScott
Created October 30, 2019 16:28
Show Gist options
  • Save ShannonScott/14ca9f890361e2d1a7b1aa1418f9b493 to your computer and use it in GitHub Desktop.
Save ShannonScott/14ca9f890361e2d1a7b1aa1418f9b493 to your computer and use it in GitHub Desktop.
[Video Screen Capture with GStreamer] Capture a Linux desktop window video with gsteramer. #tags: gstreamer, linux, xwindows, video

Capture a video of a given X Window with gstreamer.

X Window ID

Get the target window ID with the following:

xwininfo

The window ID will look something like:

xwininfo: Window id: 0x60000f "xterm"

GStreamer screen capture video to file

From the gstreamer ximagesrc documentation (update the window ID as necessary):

gst-launch-1.0 ximagesrc xid=0x60000f ! video/x-raw,framerate=5/1 ! videoconvert ! theoraenc ! oggmux ! filesink location=desktop.ogg

Capture to x264 MP4

gst-launch-1.0 ximagesrc xid=0x60000f ! video/x-raw,framerate=5/1 ! videoconvert ! queue ! x264enc pass=5 quantizer=26 speed-preset=6 ! mp4mux fragment-duration=500 ! filesink location="capture.mp4"

To Do

Convert this to a bash script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment