diff options
author | David Blajda <blajda@hotmail.com> | 2017-06-17 20:41:09 -0400 |
---|---|---|
committer | David Blajda <blajda@hotmail.com> | 2017-06-17 22:14:39 -0400 |
commit | 8d54a6746c1a441008692f7264fd0a03b25aada8 (patch) | |
tree | 100fcee028eaacb58700fb925a3297c96b327cc7 /swaygrab | |
parent | Merge pull request #1238 from her001/backgrounds_dir (diff) | |
download | sway-8d54a6746c1a441008692f7264fd0a03b25aada8.tar.gz sway-8d54a6746c1a441008692f7264fd0a03b25aada8.tar.zst sway-8d54a6746c1a441008692f7264fd0a03b25aada8.zip |
FFmpeg options for swaygrab
Diffstat (limited to 'swaygrab')
-rw-r--r-- | swaygrab/main.c | 13 | ||||
-rw-r--r-- | swaygrab/swaygrab.1.txt | 11 |
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, | |||
84 | sway_abort("Unknown output %s.", name); | 84 | sway_abort("Unknown output %s.", name); |
85 | } | 85 | } |
86 | 86 | ||
87 | const char *fmt = "ffmpeg -f rawvideo -framerate %d " | 87 | char *ffmpeg_opts = getenv("SWAYGRAB_FFMPEG_OPTS"); |
88 | if(!ffmpeg_opts) { | ||
89 | ffmpeg_opts = ""; | ||
90 | } | ||
91 | |||
92 | const char *fmt = "ffmpeg %s -f rawvideo -framerate %d " | ||
88 | "-video_size %dx%d -pixel_format argb " | 93 | "-video_size %dx%d -pixel_format argb " |
89 | "-i pipe:0 -r %d -vf vflip %s"; | 94 | "-i pipe:0 -r %d -vf vflip %s"; |
90 | char *cmd = malloc(strlen(fmt) - 8 /*args*/ | 95 | char *cmd = malloc(strlen(fmt) - 8 /*args*/ |
91 | + numlen(width) + numlen(height) + numlen(framerate) * 2 | 96 | + strlen(ffmpeg_opts) + numlen(width) + numlen(height) |
92 | + strlen(file) + 1); | 97 | + numlen(framerate) * 2 + strlen(file) + 1); |
93 | sprintf(cmd, fmt, framerate, width, height, framerate, file); | 98 | sprintf(cmd, fmt, ffmpeg_opts, framerate, width, height, framerate, file); |
94 | 99 | ||
95 | long ns = (long)(1000000000 * (1.0 / framerate)); | 100 | long ns = (long)(1000000000 * (1.0 / framerate)); |
96 | struct timespec start, finish, ts; | 101 | 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 | |||
48 | *-f, --focused*:: | 48 | *-f, --focused*:: |
49 | Capture only the currently focused container. | 49 | Capture only the currently focused container. |
50 | 50 | ||
51 | Environment Variables | ||
52 | --------------------- | ||
53 | swaygrab reads the following environment variables. | ||
54 | |||
55 | *SWAYGRAB_FFMPEG_OPTS*:: | ||
56 | Pass additional arguments to FFmpeg when starting a capture. | ||
57 | |||
51 | Examples | 58 | Examples |
52 | -------- | 59 | -------- |
53 | 60 | ||
@@ -57,6 +64,10 @@ swaygrab output.png:: | |||
57 | swaygrab -c -o HDMI-A-1 output.webm:: | 64 | swaygrab -c -o HDMI-A-1 output.webm:: |
58 | Capture a webm of HDMI-A-1. | 65 | Capture a webm of HDMI-A-1. |
59 | 66 | ||
67 | SWAYGRAB_FFMPEG_OPTS="-f alsa -i pulse" swaygrab -c:: | ||
68 | Capture the focused output and encode audio from the default recording | ||
69 | device. | ||
70 | |||
60 | Authors | 71 | Authors |
61 | ------- | 72 | ------- |
62 | 73 | ||