Black screening works

This commit is contained in:
Benjamin Bädorf 2020-07-30 15:26:22 +02:00
parent 1e2fb1bb4f
commit 25ca77c69b
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C

View file

@ -29,9 +29,10 @@ fn record_screen(config: &mut Config, valid_screens: &Vec<String>) -> Result<Chi
if valid_screens.len() == 0 { if valid_screens.len() == 0 {
let cmd = Command::new("ffmpeg") let cmd = Command::new("ffmpeg")
.args(&[ .args(&[
"--i", "-f",
"color=size=1920x1080:rate=25:color=black", "lavfi",
"--f=lavfi", "-i",
"color=c=black:s=1920x1080:r=25/1",
"-vcodec", "-vcodec",
"rawvideo", "rawvideo",
"-pix_fmt", "-pix_fmt",
@ -51,6 +52,7 @@ fn record_screen(config: &mut Config, valid_screens: &Vec<String>) -> Result<Chi
} else { } else {
let index = get_screen_index(&valid_screens[0]); let index = get_screen_index(&valid_screens[0]);
let output_str = format!("--file={}", config.output.as_str()); let output_str = format!("--file={}", config.output.as_str());
println!("Outputting to {}", output_str);
let mut cmd = Command::new("wf-recorder") let mut cmd = Command::new("wf-recorder")
.args(&[ .args(&[
"--muxer=v4l2", "--muxer=v4l2",
@ -94,10 +96,14 @@ fn get_valid_screens_for_recording(config: &Config) -> Vec<String> {
.expect("Couldn't get current focus"); .expect("Couldn't get current focus");
let stdout = String::from_utf8(output.stdout).expect("Invalid UTF-8 from get_workspaces"); let stdout = String::from_utf8(output.stdout).expect("Invalid UTF-8 from get_workspaces");
let valid_screens = stdout.split('\n').map(|s| s.to_string()).collect(); let valid_screens = stdout
for screen in &valid_screens { .split('\n')
println!("{}", screen); .map(|s| s.to_string())
} .filter(|s| s != "")
.collect();
println!("Found screens: {:?}", valid_screens);
return valid_screens; return valid_screens;
} }
@ -122,7 +128,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
workspace_blacklist: Vec::new(), workspace_blacklist: Vec::new(),
}; };
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
println!("{:?}", args);
let mut i = 1; let mut i = 1;
loop { loop {