What I am trying to do is capture the stream of an IP Cam by using avconv. I have managed to get that stream and save it to a file using the apache exec commons library for Java like this:
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
String str = avconv_command;
CommandLine commandLine = CommandLine.parse(str);
ExecuteWatchdog watchdog = new ExecuteWatchdog(1000000);
Executor executor = new DefaultExecutor();
executor.setWatchdog(watchdog);
executor.execute(commandLine, resultHandler);
With that, the avconv starts to capture the streaming and saves it to a file, and on the console I can see how the avconv is working and the output of the process. Each line of that output shows the duration of the video currently being captured, the bitrate, etc. I need to capture that output and process it while it is running. Any thoughts?
I have read many posts:
Process output from apache-commons exec
How can I capture the output of a command as a String with Commons Exec?
But they all read the output when the process has finished, and I need to read it while it is running.