aboutsummaryrefslogtreecommitdiff
path: root/swaygrab
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-06-17 23:56:59 -0400
committerGitHub <noreply@github.com>2017-06-17 23:56:59 -0400
commit25b6adb7ac47c7444afeb8c801ce154863011d83 (patch)
tree100fcee028eaacb58700fb925a3297c96b327cc7 /swaygrab
parentcd08e9160e1ccfa52262d74104a4cd58ae26f818 (diff)
parent8d54a6746c1a441008692f7264fd0a03b25aada8 (diff)
Merge pull request #1241 from Blajda/ffmpeg-opts
FFmpeg options for swaygrab
Diffstat (limited to 'swaygrab')
-rw-r--r--swaygrab/main.c13
-rw-r--r--swaygrab/swaygrab.1.txt11
2 files changed, 20 insertions, 4 deletions
diff --git a/swaygrab/main.c b/swaygrab/main.c
index 413de1fa..c437653d 100644
--- a/swaygrab/main.c
+++ b/swaygrab/main.c
@@ -84,13 +84,18 @@ void grab_and_apply_movie_magic(const char *file, const char *payload,
sway_abort("Unknown output %s.", name);
}
- const char *fmt = "ffmpeg -f rawvideo -framerate %d "
+ char *ffmpeg_opts = getenv("SWAYGRAB_FFMPEG_OPTS");
+ if(!ffmpeg_opts) {
+ ffmpeg_opts = "";
+ }
+
+ const char *fmt = "ffmpeg %s -f rawvideo -framerate %d "
"-video_size %dx%d -pixel_format argb "
"-i pipe:0 -r %d -vf vflip %s";
char *cmd = malloc(strlen(fmt) - 8 /*args*/
- + numlen(width) + numlen(height) + numlen(framerate) * 2
- + strlen(file) + 1);
- sprintf(cmd, fmt, framerate, width, height, framerate, file);
+ + strlen(ffmpeg_opts) + numlen(width) + numlen(height)
+ + numlen(framerate) * 2 + strlen(file) + 1);
+ sprintf(cmd, fmt, ffmpeg_opts, framerate, width, height, framerate, file);
long ns = (long)(1000000000 * (1.0 / framerate));
struct timespec start, finish, ts;
diff --git a/swaygrab/swaygrab.1.txt b/swaygrab/swaygrab.1.txt
index b2c6389a..1da56db8 100644
--- a/swaygrab/swaygrab.1.txt
+++ b/swaygrab/swaygrab.1.txt
@@ -48,6 +48,13 @@ Options
*-f, --focused*::
Capture only the currently focused container.
+Environment Variables
+---------------------
+swaygrab reads the following environment variables.
+
+*SWAYGRAB_FFMPEG_OPTS*::
+ Pass additional arguments to FFmpeg when starting a capture.
+
Examples
--------
@@ -57,6 +64,10 @@ swaygrab output.png::
swaygrab -c -o HDMI-A-1 output.webm::
Capture a webm of HDMI-A-1.
+SWAYGRAB_FFMPEG_OPTS="-f alsa -i pulse" swaygrab -c::
+ Capture the focused output and encode audio from the default recording
+ device.
+
Authors
-------