I am using ffmpeg to convert videos to mp4 format in my application I have used JAVE and Xuggler for the same. My issue is that, video conversions are taking way too much of time. For example, a 50MB video takes almost 2 hrs to complete the video conversion and upload the same. Also, when i play a video, it takes a longer time to play on safari on mac OS than chrome/firefox.
What are the possible solutions for this? How to optimize the conversion time/video buffering for playing the video faster
I am using the it.sauronsoftware.jave.VideoAttributes and EncodingAttributes classes to do this
VideoAttributes video = new VideoAttributes();
video.setCodec("libx264");
EncodingAttributes attributes = new EncodingAttributes();
attributes.setFormat("mp4");
attributes.setVideoAttributes(video);
Encoder encoder = new Encoder(new FFMPEGLocator() {
@Override
protected String getFFMPEGExecutablePath() {
String ffmpegPath = PropertiesUtil
.getProperty("location.ffmpeg");
return ffmpegPath;
}
});
encoder.encode(sourceFile, destFile, attributes);
sourceFile and destFile are the source and destination files respectively