2012-04-01 1 views

답변

2

Xuggle을 살펴보십시오. 이 tutorial가 도움이 될 것입니다. 간단한 예제 아래에 쉽게 빌드 할 수 있습니다. 개별 프레임의 비디오 스트림을 생성

"실시간"예 :

IMediaWriter writer = ToolFactory.makeWriter("C:/movie.mp4"); 
// We tell it we're going to add one video stream, with id 0, 
// at position 0, and that it will have a fixed frame rate of 
// FRAME_RATE. 
writer.addVideoStream(0, 0, IRational.make(FRAME_RATE), width, height); 
try { 
    long startTime = System.nanoTime(); 
    while(true) { 
     final BufferedImage screen = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); 
     // Draw the frame 
     // encode the image to stream #0 
     writer.encodeVideo(0, screen, System.nanoTime() - startTime, TimeUnit.NANOSECONDS); 
     Thread.sleep(1000/FRAME_RATE); 
    } 
} catch (RuntimeException x) { 
    // Problem 
} finally { 
    writer.close(); 
} 
4

간단한 AVI 동영상을 만들 수있는 순수 자바 솔루션입니다 베르너 Randelhofer의 AVIDemo에서보세요. 확실히 Xuggle과 같은 기본 접근 방식만큼 빠르지 만 설정과 사용이 매우 쉽습니다. Werner는 AVIDemo를 대신하는 새로운 Monte Media Library를 보유하고 있지만 아직 사용하지 않아서 사용하기가 쉽지 않습니다.

업데이트 2,017분의 8

JCodec는 H.264/MP4 등 여러 영화 형식에 대한 인코더를 제공합니다. 일련의 BufferedImages (예 : Java로 촬영 한 자동화 된 스크린 샷)를 비디오 파일로 변환 할 수 있습니다.