2017-03-03 27 views
1

내 프로그램은 화면 캡처 비디오를 AVI 파일로 만들고 마이크의 음성을 WAV 파일에 녹음합니다. 끝나면 두 파일을 하나의 파일로 결합합니다 (기본적으로 WAV 파일을 오디오의 비디오 파일에 추가하십시오).AVI와 WAV 파일을 클라이언트 측 JAVA 만 사용하여 결합하는 방법은 무엇입니까?

내가 다음 코드를 사용하여 캡처 화면을합니다 (ScreenRecorder 클래스는 org.monte.screenrecorder에서입니다) : 나는 그래서 당신은 모든 형식을 볼 수 있습니다 (같은 그것을 할 음성 녹음을 위해

GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment(). 
    getDefaultScreenDevice().getDefaultConfiguration(); 

Format fileFormat = new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI); 
Format screenFormat = new Format(MediaTypeKey, MediaType.VIDEO, 
        EncodingKey, ENCODING_AVI_MJPG, 
        CompressorNameKey, ENCODING_AVI_MJPG, 
        DepthKey, (int)24, 
        FrameRateKey, Rational.valueOf(15), 
        QualityKey, 1.0f, 
        KeyFrameIntervalKey, (int) (15 * 60)); 
Format mouseFormat = new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,"black", 
FrameRateKey, Rational.valueOf(30)); 
screenRecorder = new ScreenRecorder(gc, fileFormat, screenFormat, mouseFormat, null); 

파라미터 등)

float sampleRate = 44100; 
int sampleSizeInBits = 16; 
int channels = 2; 
boolean signed = true; 
boolean bigEndian = true;  
AudioFormat format new AudioFormat(sampleRate, sampleSizeInBits, channels, signed, bigEndian); 
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format); 

// checks if system supports the data line 
if (!AudioSystem.isLineSupported(info)) { 
    System.out.println("Line not supported"); 
    System.exit(0); 
} 
line = (TargetDataLine) AudioSystem.getLine(info); 
line.open(format); 
line.start(); // start capturing 

System.out.println("Start capturing..."); 

AudioInputStream ais = new AudioInputStream(line); 

System.out.println("Start recording..."); 

// start recording 
AudioSystem.write(ais, fileType, wavFile); 

난 소용, 다음 방법을 시도 : JMF (으로 javax.media.Manager, 그것은 createRealizedProcessor 죽는다) Xuggle (com.xuggle.mediatool 및 com.xuggle한다. xuggler)

저는 입력 형식이 마음에 들지 않아 작동하지 않는다고 확신합니다.

그래, 난 쉽게 명령 줄이나 서버에서 FFMPEG와 병합 할 수 있지만, 나에게 좋지 않다, 나는 클라이언트 측 자바 솔루션을 필요로한다. (정말로 FFMPEG를 설치하도록 사용자에게 요청할 수는 없다. Runtime.getRuntime(). exec 등으로 호출 할 수 있습니다.

답변

1

당신과 비슷한 목적으로 사용 된 vlcj 라이브러리를 사용해 보시기 바랍니다.

http://caprica.github.io/vlcj/

읽 시도하고 동시에 별도로 두 가지를 재생하거나이 라이브러리를 제공하는 다른 방법을 시도 할 수 있습니다. 이 라이브러리로도 녹음 할 수 있습니다.

+0

감사합니다. 시험해 보겠습니다. – KBalazs