Reputation: 4775
I have some 20k+ mp3s that I am trying to extract their thumbnail and save them as jpeg files on disk. I am using ffmpeg to get the job done. In order to speed things up I created a java application that runs five threads and processes five images at the same time.
The problem is that sometimes ffmpeg hangs. I check htop and I see five instances of ffmpeg running with no CPU usage, they just sit there doing nothing.
If I however opt to use a single thread things work fine. This is how I run ffmpeg to extract the audio thumbnail:
private void vGetAudioFrames(String input)
{
try
{
ProcessBuilder procBuilder = new ProcessBuilder("ffmpeg", "-i" , input, input + ".jpg");
Process process = procBuilder.start();
process.waitFor();
}
catch (IOException e)
{
}
}
I am not sure what I'm doing wrong. The call is too simple and I'm not sure if I need additional parameters to make it work.
Upvotes: 0
Views: 1586
Reputation: 4775
Sorry about that, it seems to be that it hangs when the output file already exists. There was a flow in my queue retrieval that caused the same file to be pulled twice on the same cycle.
Upvotes: 2