Skip to content

Instantly share code, notes, and snippets.

@gilbertw1
Created February 25, 2017 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilbertw1/ea6fe0b18364c73484bf8872b9cab6a7 to your computer and use it in GitHub Desktop.
Save gilbertw1/ea6fe0b18364c73484bf8872b9cab6a7 to your computer and use it in GitHub Desktop.
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