ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [동영상] FFmpeg로 Thumbnail 추출하기
    JAVA/동영상 2019. 11. 11. 17:39
    반응형

    이번 포스팅은 ffmpeg를 이용하혀 Thumbnail을 추출하려고 한다.

    간단함으로 코드만 남긴다.

    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();
    		}       
    
    
    	}
    }
    반응형

    'JAVA > 동영상' 카테고리의 다른 글

    [동영상] FFmpeg로 동영상 재생 시간 추출하기(WINDOW)  (0) 2019.11.11
Designed by Tistory.