Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert AVI, MOV, WMV в MP4 #2195

Open
Arman06061999 opened this issue Feb 28, 2024 · 1 comment
Open

convert AVI, MOV, WMV в MP4 #2195

Arman06061999 opened this issue Feb 28, 2024 · 1 comment

Comments

@Arman06061999
Copy link

Arman06061999 commented Feb 28, 2024

public File convertToMp4(File file) throws IOException, FrameGrabber.Exception, FrameRecorder.Exception {
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(file);
grabber.start();
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(file, 0);
recorder.setFormat("mp4");
recorder.setFrameRate(grabber.getFrameRate());
recorder.setSampleRate(grabber.getSampleRate());
recorder.setVideoCodec(grabber.getVideoCodec());
recorder.setAudioCodec(grabber.getAudioCodec());
recorder.start();
Frame frame;
while ((frame = grabber.grabFrame()) != null) {
recorder.record(frame);
}
recorder.stop();
recorder.release();
grabber.stop();
grabber.release();

}  guys, please tell me what I'm doing wrong, I'm trying to convert these files to mp4 format, point to the errors, the user from the web application will convert his video file to mp4.
@Arman06061999 Arman06061999 changed the title конвертировать AVI, MOV, WMV в MP4 convert AVI, MOV, WMV в MP4 Feb 28, 2024
@saudet
Copy link
Member

saudet commented Mar 9, 2024

We can easily accomplish this with the ffmpeg program:
http://bytedeco.org/javacpp-presets/ffmpeg/apidocs/org/bytedeco/ffmpeg/ffmpeg.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants