Let me start by saying that I am completely new to Java. I’m from a PHP background, but it happens that one of my PHP tasks needs to be converted to Java.
The task is to split the video into frames using ffmpeg, and then work with these frames. I completed this process in PHP. And now I can convert it to Java.
I looked through some lessons and got the databases (using the IDE, running a java program, etc.). I use Eclipse for this purpose.
I managed to run ffmpeg using a java program using
public static void main(String[] args) throws IOException { String livestream = "D:/video.mpg"; String folderpth = "D:/frames"; String cmd="D:/ffmpeg/bin/ffmpeg.exe -i "+ livestream +" -r 10 "+folderpth+"/image%d.jpg";
This works fine, I get frames in the folder. Now what I want to do is kill the process after some, say, 5 minutes, because the video lasts more than 2 hours, and I don’t want you to come to the taskbar and kill the process manually. I would also like to know if there is a way to save the frame names created by ffmpeg into an array for future use.
I tried using p.destroy() , but this did not stop the process at all. How can I use something similar like setTimeout() which is used in jQuery?
Some metadata
OS: Windows 7
IDE: Eclipse
source share