How-to Transcode an Audio-Only or Video-Only Output
Before you start
This guide assumes that you understand the basics of making a Transcode API request. We recommend completing the Getting Started with Transcoding Media guide first.
Transcode an audio-only or video-only output
Sometimes you might want to extract the audio from an input file that contains both audio and video. You might do this if you need to generate a file for transcription or if you are generating audio-only variants for How to Transcode to HLS Streaming Format.
Or perhaps the inverse is true, where you want to output a file that contains video with no audio.
This guide shows you how to use the Media Transcode API to take an input file and output to an audio-only output or video-only output.
Default behavior
By default, the Media Transcode API will output both video and audio if they exist in an input file.
Removing video or audio
You can explicitly tell the Transcode API to "remove"
either video
or audio
in your API call when you define an output
. Here is a snippet to demonstrate creating an audio-only output file and a video-only output file:
"outputs": [
{
"id" : "my-audio-only-output",
"destination" : {
"ref" : "my-s3-storage",
"filename" : "audio-only.mp4"
},
"kind" : "mp4",
"video": "remove"
},
{
"id" : "my-video-only-output",
"destination" : {
"ref" : "my-s3-storage",
"filename" : "video-only.mp4"
},
"kind" : "mp4",
"audio": "remove"
}
]
In the above example, we are not providing any audio
or video
configuration settings, so we are leaving it to the API to choose the defaults based on the kind
. Of course, you can always customize your parameters to specify a format, see our guide on How to Transcode to a Specification.
To help feel inspired, review the steps on how to create an audio podcast from a video or how to avoid YouTube's automatic re-configuration by transcoding.
Updated 2 months ago