Skip to content

Commit 3d8891c

Browse files
committed
[rust] Modify command to record desktop with x11grab
1 parent 81ff737 commit 3d8891c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

rust/src/ffmpeg.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ const FFMPEG_MACOS_RELEASE_URL: &str = "https://evermeet.cx/ffmpeg/ffmpeg-{}.zip
4444
const FFMPEG_RECORD_FRAME_RATE: &str = "30";
4545
const FFMPEG_RECORD_DESKTOP_WINDOWS_COMMAND: &str = "{} -f gdigrab -i desktop -r {} -q:v 1 -y {}";
4646
const FFMPEG_RECORD_DESKTOP_LINUX_COMMAND: &str =
47-
"{} -f x11grab -i {}:0 -r {} -vcodec huffyuv -y {}";
47+
"{} -f x11grab -i {}+0,0 -r {} -vcodec huffyuv -y {}";
4848
const FFMPEG_RECORD_DESKTOP_MACOS_COMMAND: &str = r#"{} -f avfoundation -i "0:0" -r {} -y {}"#;
4949
const FFMPEG_RECORDING_EXTENSION: &str = "avi";
5050
const FFMPEG_RECORDING_FOLDER: &str = "recordings";
51+
const FFMPEG_DEFAULT_DISPLAY: &str = ":0";
5152

5253
pub fn download_ffmpeg(
5354
ffmpeg_version: String,
@@ -211,7 +212,7 @@ pub fn record_desktop_with_ffmpeg(
211212
FFMPEG_NAME, &recording_name
212213
));
213214
let command = if LINUX.is(os) {
214-
let env_display = env::var(ENV_DISPLAY).unwrap_or_default();
215+
let env_display = env::var(ENV_DISPLAY).unwrap_or(FFMPEG_DEFAULT_DISPLAY.to_string());
215216
Command::new_single(format_four_args(
216217
get_recording_command(os),
217218
&path_to_string(&ffmpeg_path),

0 commit comments

Comments
 (0)