Created
June 30, 2016 13:57
-
-
Save tatesuke/dce29391d6604b86c3a9b7bcb145e958 to your computer and use it in GitHub Desktop.
動画からjpg切り抜き
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hoge; | |
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import java.io.IOException; | |
import javax.imageio.ImageIO; | |
import org.bytedeco.javacv.FFmpegFrameGrabber; | |
import org.bytedeco.javacv.FrameGrabber.Exception; | |
import org.bytedeco.javacv.Java2DFrameConverter; | |
public class Main { | |
public static void main(String[] args) throws Exception, IOException { | |
FFmpegFrameGrabber g = new FFmpegFrameGrabber("sample.mov"); | |
g.start(); | |
Java2DFrameConverter converter = new Java2DFrameConverter(); | |
for (int i = 0; i < 15; i++) { | |
BufferedImage image = converter.convert(g.grab()); | |
ImageIO.write(image, "jpg", new File( | |
"frame-dump/video-frame-" + System.currentTimeMillis() | |
+ ".jpg")); | |
} | |
g.stop(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>hoge</groupId> | |
<artifactId>hoge</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<dependencies> | |
<dependency> | |
<groupId>org.bytedeco</groupId> | |
<artifactId>javacv</artifactId> | |
<version>1.0</version> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment