Convert MPG to MP4 in Java

In video production, the ideal format for adding complex, detailed information to your file is MP4. When used in video editing software, it allows for increased metadata loads such as subtitles and complex audio. Thus, when downloading videos in the classic MPG format for use in your content, it may be necessary to first convert the files to MP4. This API will allow you to perform this action in Java, to help improve your video quality and production speeds.

Image for post
Image for post

Our first step is to install with Maven. You will need to add a Jitpack reference to the repository in pom.xml:

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

Then, you can add a reference to the dependency:

<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v3.54</version>
</dependency>
</dependencies>

Once this has been completed, we can call our function, VideoConvertToMp4:

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.VideoApi;

Now, you can ensure that your video content can maintain the highest standards in quality and fidelity, while improving compatibility with most operating systems. To access your free API Key, you can visit the Cloudmersive website. This will give you access to 800 monthly calls across our library of APIs.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store