Audio/Video API: Get Detailed Information about an Audio or Video File with Java

You can pull useful information (including format, dimensions, file size, bit rate & more) from Audio and Video files easily using the Get Info iteration of our Video API. Take advantage of instructions & code snippets provided below to implement this API with Java, or visit our API platform page to find more ready-to-run code available in other common programming languages.

Start by installing the Java SDK (instructions included in this article for Maven). First, add a reference to the repository in pom.xml:


Next, add one to the dependency:


Now, complete the process by adding in the import classes and calling the function:

// 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;
ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
VideoApi apiInstance = new VideoApi();
File inputFile = new File("/path/to/inputfile"); // File | Input file to perform the operation on.
String fileUrl = "fileUrl_example"; // String | Optional; URL of a video file being used for conversion. Use this option for files larger than 2GB.
try {
MediaInformation result = apiInstance.videoGetInfo(inputFile, fileUrl);
} catch (ApiException e) {
System.err.println("Exception when calling VideoApi#videoGetInfo");



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


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