Created
February 25, 2017 02:47
-
-
Save gilbertw1/ea6fe0b18364c73484bf8872b9cab6a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn start_cropped_screencast_process_gif(slop_out: &SlopOutput, out_path: &Path) -> (Child, Child) { | |
let ffmpeg_proc = | |
Command::new("ffmpeg") | |
.args(&["-f", "x11grab", | |
"-s", &format!("{}x{}", slop_out.w, slop_out.h), | |
"-i", &format!(":0.0+{},{}", slop_out.x, slop_out.y), | |
"-an", | |
"-f", "image2pipe", | |
"-vcodec", "ppm", | |
"-"]) | |
.stdout(Stdio::piped()) | |
.stderr(Stdio::null()) | |
.spawn().unwrap(); | |
let imagick_proc: Child; | |
unsafe { | |
imagick_proc = | |
Command::new("convert") | |
.args(&["-delay", "5", | |
"-loop", "0", | |
"-", | |
&out_path.to_string_lossy().into_owned()]) | |
.stdin(Stdio::from_raw_fd(ffmpeg_proc.stdout.as_ref().unwrap().as_raw_fd().clone())) | |
.stderr(Stdio::null()) | |
.spawn().unwrap(); | |
} | |
(ffmpeg_proc, imagick_proc) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment