Skip to content

Instantly share code, notes, and snippets.

@rasheedamir
Created September 8, 2015 10:06
Show Gist options
  • Select an option

  • Save rasheedamir/79c390fe21884666fe44 to your computer and use it in GitHub Desktop.

Select an option

Save rasheedamir/79c390fe21884666fe44 to your computer and use it in GitHub Desktop.
find fps - frames per second
String query = "ffmpeg -i foo.avi 2>&1 | sed -n 's/.*, \\(.*\\) fp.*/\\1/p' > fps.txt";
String[] command = {"gnome-terminal", "-x", "/bin/sh", "-c", query};
Process process = Runtime.getRuntime().exec(command);
process.waitFor();
Thread.sleep(2000);
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("fps.txt")));
output = br.readLine();
} catch (IOException ioe) {
ioe.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment