以下是Monte Media Library。 http://www.randelshofer.ch/monte/
我正在使用MonteScreenRecorder jar进行录制屏幕。
我能够以avi格式存储视频文件,但我想以mp4格式存储
这是avi的代码
import java.awt.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.monte.media.Format;
import org.monte.media.math.Rational;
import org.monte.screenrecorder.ScreenRecorder;
import static org.monte.media.VideoFormatKeys.*;
...
private ScreenRecorder screenRecorder;
public void startRecording() throws Exception
{
GraphicsConfiguration gc = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getDefaultScreenDevice()
.getDefaultConfiguration();
this.screenRecorder = new ScreenRecorder(gc,
new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI),
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
DepthKey, 24, FrameRateKey, Rational.valueOf(15),
QualityKey, 1.0f,
KeyFrameIntervalKey, 15 * 60),
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black",
FrameRateKey, Rational.valueOf(30)),
null);
this.screenRecorder.start();
}
public void stopRecording() throws Exception
{
this.screenRecorder.stop();
}
...
需要进行哪些更改让我知道。
请帮助
谢谢
答案 0 :(得分:0)
我会使用ffmpeg。以下是关于superuser.com的问题,可能有助于设置。
答案 1 :(得分:0)
现在为时已晚,但这可能有助于其他人。 您可以使用VLCJ库以mp4格式记录屏幕。 VLCJ库为VLC媒体播放器提供java绑定。 您可以找到VLCJ库教程here