This topic describes how to configure the Timeline parameter when you call the SubmitMediaProducingJob operation in different audio processing scenarios.
Usage notes
Intelligent production supports editing and compositing, effect rendering, and templates for live streams, VOD files, and material files from Object Storage Service (OSS). For more information, see Intelligent production overview.
You can produce a video from one or more videos, audio files, images, and subtitle materials by configuring Timeline parameters and calling the SubmitMediaProducingJob operation.
A timeline is created when you add materials and configure effects to create a video. A timeline consists of tracks, materials, and effects. For more information, see Timeline configurations.
For more information about how to use the IMS SDK to edit audio and video files, see Preparations.
Audio processing for videos
Mute an entire video
You can configure the Effects element to mute an entire video.
The Gain field specifies a gain level. The value 0 specifies that the video is muted.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Adjust the volume
You can adjust the volume for audio and video clips.
The following sample code sets the gain level of the video clip to 0.5 and the gain level of the audio clip to 2.
The Gain field specifies a gain level. You can set the gain level to one of the following values:
0: mute.
1: original volume.
A value between 0 and 1: less than the original volume but not muted. A smaller value indicates a smaller gain level.
A value greater than 1: greater than the original volume. A larger value indicates a greater gain level.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Mute an entire video and mix audio
A common audio processing scenario is to mute an entire video and then mix audio into the video.
All audio clips to use must be placed within the AudioTracks element.
If the TimelineIn field is not specified, the audio mixing starts from the beginning of the video clip.
If the TimelineOut field is not specified, the entire audio clip is used for mixing. If the audio clip is longer than the video clip, the audio section to mix into the video has the same length as the video clip and the trailing audio section is truncated.
The AudioTrackClips element can contain audio-only clips or video clips that have audio.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Mute an entire video and mix audio from multiple audio clips
You can mute an entire video and mix audio from multiple audio clips.
The following sample code mutes the entire video and mixes audio from two audio clips:
The audio section from the 1st second to the 5th second in the m1.wav clip is mixed into the section from the 2nd second to the 6th second in the video clip, with the audio gain level set to 2.
The audio section from the 2nd second to the 10th second in the speech.mp3 clip is mixed into the section from the 4th second to the 12th second in the video clip, with the audio gain level set to 0.5.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Configure audio loop playback
The following sample code mutes the video clip and repeatedly plays the section of the m2.wav audio from the 4th second to the 10th second over the timeline part of the 2nd second to the 14th second.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Audio fade-in and fade-out
Configure fade-in and fade-out for an audio-only clip
You can set the Type field to AFade to configure audio fade-in and fade-out.
The following sample code sets a fade-in effect for 3 seconds and a fade-out effect for 4 seconds. Fade-in increases the volume linearly, whereas fade-out decreases the volume linearly.
For more information about the AFade effect, see AFade.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Configure audio fade-in and fade-out for a video clip
You can apply fade-in and fade-out effects to audio in a video. The configurations are the same as those of fade-in and fade-out for an audio-only clip.
The following sample code sets a fade-in effect for 3 seconds of the audio track and a fade-out effect for 4 seconds of the audio track. Fade-in increases the volume linearly, whereas fade-out decreases the volume linearly.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Mute a specific section of an audio track
You can mute a specific section of an audio track by specifying the start position and end position to mute.
The following sample code mutes the audio section from the 2nd second to the 5th second.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Specify the start position of audio mix
When you mute an video and mix audio into the video, you can specify the start position and end position of the mix.
The following sample code mixes the audio section of the 10th second to the 19th second into the video starting from the 5th second of the video.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Reduce noise
You can reduce noise in audio-only and video clips.
For more information about values of the Mode field, see ADenoise.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Mix audio in a video
You can mix multiple audio tracks into a video.
In the following example, the gain level of the sections from the 4th second to the 6th second and from the 9th second to the 14th second in the h4.mp4 clip is set to 0.8.
In addition, audio from two audio tracks is mixed into the video.
The audio section from the 10th second to the 17th second in the m1.wav clip is mixed into the section from the 4th second to the 11th second in the video clip, with the audio gain level set to 2.
The audio section from the 15th second to the 20th second in the speech.mp3 clip is mixed into the section from the 9th second to the 14th second in the video clip.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Normalize audio
This setting applies only to audio and video clips. If ALoudNorm is used together with ADenosie or Volume, the settings take effect in the following order: ADenoise > Volume > ALoudNorm.
You can normalize the volume of the audio.
Effect
Timeline example
Effect
Timeline example
Audio processing
{ "AudioTracks": [ { "AudioTrackClips": [ { "Comment": "Normalize the volume of the audio", "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/music/m1.wav", "Effects": [ { "Type": "ALoudNorm", "Loudness": -24.0, "TruePeak": -2.0 } ] }, { "Comment": "Normalize the volume of the audio", "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/music/m2.wav", "Effects": [ { "Type": "ALoudNorm", "Loudness": -24.0, "TruePeak": -2.0 } ] } ] } ] }
You can normalize the volume of audio in a video.
Effect
Timeline example
Effect
Timeline example
Audio processing
{ "VideoTracks": [ { "VideoTrackClips": [ { "Comment": "Normalize the volume of audio in a video", "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h4.mp4", "Effects": [ { "Type": "ALoudNorm", "Loudness": -24.0, "TruePeak": -2.0 } ] }, { "Comment": "Normalize the volume of audio in a video", "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4", "Effects": [ { "Type": "ALoudNorm", "Loudness": -24.0, "TruePeak": -2.0 } ] } ] } ] }
Equalize the volume
This setting takes effect globally and cannot take effect for a single clip.
You can equalize the volume of audio in a video.
Effect
Timeline example
Effect
Timeline example
Audio processing
{ "VideoTracks": [ { "VideoTrackClips": [ { "Comment": "Equalize the volume of audio in a video", "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h4.mp4" }, { "Comment": "Equalize the volume of audio in a video", "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4" } ] } ], "EffectTracks": [ { "EffectTrackItems": [ { "Type": "AEqualize", "Peak": 0.95, "Gain": 10 } ] } ] }
You can equalize the volume of audio.
Effect
Timeline example
Effect
Timeline example
Audio processing
{ "AudioTracks": [ { "AudioTrackClips": [ { "Comment": "Equalize the volume of audio", "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/music/m1.wav" }, { "Comment": "Equalize the volume of audio", "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/music/m2.wav" } ] } ], "EffectTracks": [ { "EffectTrackItems": [ { "Type": "AEqualize", "Peak": 0.95, "Gain": 10 } ] } ] }
Audio-only output clips
Extract audio
You can extract audio from a video clip by specifying the video clip in the AudioTrackClips field of the AudioTracks element.
Effect | Timeline example |
Effect | Timeline example |
|
Merge audio clips
You can merge specified sections of two audio clips in a particular order into one audio track.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|
Mix audio from multiple audio-only clips
You can mix audio from multiple audio-only clips.
Effect | Timeline example |
Effect | Timeline example |
Audio processing |
|