I am working on creating a progress bar for ffmpeg in java. So for that I need to execute a command, then read all of the progress:
String[] command = {"gnome-terminal", "-x", "/bin/sh", "-c","ffmpeg -i /home/tmp/F.webm /home/tmp/converted1.mp4"};
Process process = Runtime.getRuntime().exec(command);
This runs perfectly. However, I need to capture the all of the progress to make a progress bar. So how can I read that data from java?
Here’s a complete example for you which should get you started
Output:
You may also consider using some kind of Java bindings for ffmpeg such as jjmpeg which may provide what you need in a more robust way.
EDIT
With ffmpeg 2.0, time output is
HH:mm:ss.Sso thetimePatternneeds a to incorporate a:In addition, the
durwill need to be split on:and summed together