From 3c051e70e5cfe32a0f2379c7a23320a9be88a0d2 Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 9 Jan 2024 21:31:09 +0000 Subject: deploy: 9679f071a80dddfa3dc33b084826ff8a16725ba4 --- tools/ffmpeg.html | 253 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 tools/ffmpeg.html (limited to 'tools/ffmpeg.html') diff --git a/tools/ffmpeg.html b/tools/ffmpeg.html new file mode 100644 index 0000000..11453a1 --- /dev/null +++ b/tools/ffmpeg.html @@ -0,0 +1,253 @@ + + + + + + ffmpeg - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+
+

ffmpeg (1)

+

screen capture specific window (x11)

+

Following snippet allows to select a window which is then captured.

+
#!/bin/bash
+
+echo "Click on window to record .."
+# Extract window size and x,y offset.
+video_args=$(xwininfo \
+    | awk '/Absolute upper-left X:/ { xoff = $4 }
+           /Absolute upper-left Y:/ { yoff=$4 }
+           /Width:/ { if ($2 % 2 == 1) { width=$2-1; } else { width=$2; } }
+           /Height:/ { if ($2 % 2 == 1) { height=$2-1; } else { height=$2; } }
+           END { printf "-video_size %dx%d -i :0.0+%d,%d", width, height, xoff, yoff  }')
+
+ffmpeg -framerate 25 -f x11grab $video_args -pix_fmt yuv420p $@ output.mp4
+
+
+

Use yuv420p pixel format if video is played on the web +(ref)

+
+

The input -i 0,0+xoff,yoff means to capture $DISPLAY=0.0 starting at the +coordinate (xoff, yoff), which is the left-upper corner, and the size of the +capture is defined by the -video_size argument.

+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + +
+ + -- cgit v1.2.3