Friday, 11 August 2017
Create Thumbnail in Video in Spring and ffmpeg
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.jcodec.api.FrameGrab;
import org.jcodec.api.JCodecException;
import org.jcodec.common.model.Picture;
import org.jcodec.scale.AWTUtil;
public class VideoThumbTaker
{
private String VIDEO_THUMBNAIL_FOLDER_NAME = "thumbnail";
private String UPLOAD_DIRECTORY = "D:/images/"
protected String ffmpegApp;
public VideoThumbTaker(String ffmpegApp)
{
this.ffmpegApp = ffmpegApp;
}
public static String captureImage(String inputFile, int organizationId) throws Exception, IOException, JCodecException
{
String filename = Constants.VIDEO_THUMBNAIL_FILE_PREFIX+System.currentTimeMillis()+".png";
int frameNumber = 1;
Picture picture = FrameGrab.getFrameFromFile(new File(inputFile), frameNumber);
BufferedImage bufferedImage = AWTUtil.toBufferedImage(picture);
ImageIO.write(bufferedImage, "png", new File(UPLOAD_DIRECTORY+"/"+VIDEO_THUMBNAIL_FOLDER_NAME+"/" + filename));
return "o"+organizationId+"/"+VIDEO_THUMBNAIL_FOLDER_NAME+"/" + filename;
}
}
Subscribe to:
Post Comments (Atom)
Create Thumbnail in Video in Spring and ffmpeg
import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import org.jcodec.api.Fr...
-
import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import org.jcodec.api.Fr...
-
To continue my series on the power of Zone, I examine yet another powerful and useful way you can use zones to improve your application. I...
-
Recall that the equation of a straight line is given by the equation y = mx +n (1) where m is called the slope of the line. (This m...
No comments:
Post a Comment
Thanks to comment our blog. i will contact you as soon as possible