ffmpeg를 이용하혀 Thumbnail을 추출하는 방법
전 포스팅에 ffmpeg설치 및 사용법이 있다.
import java.io.IOException; public class VideoTimeCut { public static void main(String[] args) throws IOException { thumbnail(); } public static void thumbnail() { Runtime run = Runtime.getRuntime(); String videofile = "C:/Users/Min/Desktop/test1/test.mp4"; String command = "C:/ffmpeg-20191109-0f89a22-win64-static/bin/ffmpeg.exe -i \"" + videofile + "\" -ss 00:00:01 -vcodec png -vframes 1 \"" +videofile + "_%2d.png\""; // 동영상 1초에서 Thumbnail 추출 System.out.println(command); try{ run.exec("cmd.exe chcp 65001"); // cmd에서 한글문제로 썸네일이 만들어지지않을시 cmd창에서 utf-8로 변환하는 명령 run.exec(command); }catch(Exception e){ System.out.println("error : "+e.getMessage()); e.printStackTrace(); } } }
728x90
반응형
'Back-end > JAVA & Spring' 카테고리의 다른 글
[java] Xuggler 비디오 정보 구하기 (0) | 2021.11.24 |
---|---|
[JAVA] xuggler 를 사용한 동영상 길이 추출 (0) | 2021.11.24 |
[JAVA] FFmpeg로 동영상 재생 시간 추출하기(WINDOW) (0) | 2021.11.24 |
[Java] 파일에서 확장자(File extension) 얻는 방법 (0) | 2021.11.23 |
[Java] 영상에서 썸네일(Thumbnail) 추출하기 (0) | 2021.11.23 |
댓글