I want to get all frames from video in jpg. For .mp4 file program works great but for .mkv i got NullPointerException I don't know why. I use JCodec
public static void Frames(File video, String destiny){
boolean check = true;
int i = 1;
while (check == true) {
try {
BufferedImage frame = FrameGrab.getFrame(video, i); //22
ImageIO.write(frame, "jpg", new File(destiny+"/photo" + i + ".jpg"));
System.out.println("Now: " + i);
} catch (ArrayIndexOutOfBoundsException e) {
check = false;
}
catch(JCodecException e){
e.printStackTrace();
}
catch(IOException e){
e.printStackTrace();
}
i++;
}
}
.
Exception in thread "main" java.lang.NullPointerException
at org.jcodec.api.FrameGrab.<init>(FrameGrab.java:59)
at org.jcodec.api.FrameGrab.getFrame(FrameGrab.java:331)
at Pack.Main.Frames(Main.java:22)
at Pack.Main.main(Main.java:77)
Thanks
Aucun commentaire:
Enregistrer un commentaire