Change Video Codec – How To Edit Videos Via API

Converting all kinds of video files to other video formats is a strong suit of Online-Convert.com and our API. Likewise, converting music and other audio files to video and vice versa is possible as well. But we can do more!

With the help of the API you are now able to edit your video files when it comes to different video and audio codecs! Using a free tool called Postman, you can now change different codecs in your video files. To do so and use Postman, you don’t have to be a developer. We have created a tutorial for you on how to use Postman to test our API. Once you get the hang of it, you can start editing video files!

 

How To Change Codecs For Video Files

Assuming that you learned how to send basic requests to Postman, all you need to do is change the code you send. In the options of your request, you can add the codec you wish to change. Following, we will show you how to do this for both video and audio codecs.

 

Change Video Codec

When sending your POST request, the video codecs you want to change can be specified in the options. This means the following snipped should be part of the “conversion” part of your code.

"options": {
        "codec": "h.264"
      }

 

For example, the code for a whole conversion, including input file, would look like this:

{
    "input": [{
      "type": "remote",
      "source": "https://cdn.online-convert.com/example-file/video/mp4/example_small.mp4"
    }],
    "conversion": [{
      "category": "video",
      "target": "mp4",
      "options": {
        "codec": "mpeg1video"
      }
    }]
}

 

There are several video codecs supported by our API, depending on the video format you are converting to. The whole list contains the following codecs:

  • dx50
  • h.263
  • h.264
  • h.265
  • huffyuv
  • mjpeg
  • mpeg1video
  • mpeg2video
  • mpeg4
  • msmpeg
  • screen_video
  • screen_video_2
  • sorenson
  • theora
  • vp8
  • vp9
  • wmv7
  • wmv8
  • xvid

 

However, not all codecs are supported by all video formats you can convert to. But there are two ways to find out which codecs are actually supported by the file you need.

  1. Check this list here: https://api2.online-convert.com/conversions?page=2
    Simply search for the format you want to convert to and check the list of codecs.
  2. Check a format directly using this link: https://api2.online-convert.com/conversions?target=avi
    In the URL, simply replace the format extension (here “avi”) with the extension you want to check

 

Change Audio Codec

Changing the audio codec of a video is just as easy as changing the video codec. It is also done using the options of a “conversion” request, just using another command:

"options": {
        "audio_codec": "flac"
      }

 

A full command to change the audio codec of a video file would look like this:

{
    "input": [{
      "type": "remote",
      "source": "https://cdn.online-convert.com/example-file/video/mp4/example_small.mp4"
    }],
    "conversion": [{
      "category": "video",
      "target": "mp4",
      "options": {
        "audio_codec": "mp3"
      }
    }]
}

 

There are several audio codecs you can choose from when converting to video. The full list is the following:

  • acc
  • adpcm
  • adpcm_ms
  • amr-nb
  • asao
  • flac
  • mp2
  • mp3
  • opus
  • pcm_s16_be
  • pcm_s16_le
  • pcm_u8
  • speex
  • vorbis
  • wmav1
  • wmav2

 

For specific audio codecs able to choose for certain video files, check the two links from above. They are all listed there as well.

 

Change Audio & Video Codec At Once

Last but not least, lets have a look at what our code would look like to change both the video and audio codec at the same time.

{
    "input": [{
      "type": "remote",
      "source": "https://cdn.online-convert.com/example-file/video/avi/example_small.avi"
    }],
    "conversion": [{
      "category": "video",
      "target": "avi",
      "options": {
        "codec": "mpeg4",
        "audio_codec": "aac"
      }
    }]
}

Want to get in touch with us? Hit us up on our social media channels!