Basically I have the same issue mentioned here: https://repost.aws/questions/QUp6krkiXUSmu6YMln7dnHdw/aws-media-convert-removes-silent-audio-which-causes-the-output-video-to-be-severly-out-of-sync-with-audio. That post doesn't give an answer, claiming it was a internal MediaConvert bug which got fixed.
I have a 66 second long .mka audio file, generated by Twilio's video room recording API. I want to convert it to a format accepted by AWS Transcribe, so I am using AWS Elemental MediaConvert to convert it to mp4 (converting to mp3 would also be fine).
The input file is a recording which is mostly just very quiet background noise, but features speech for the last few seconds. AWS Elemental MediaConvert seems to be chopping off the initial part which doesn't include speech, returning an mp4 which is just 14 seconds long corresponding to the last 14 seconds of the input.
But I want the output file to be the same length as the input file. How do I accomplish this?
Here is my MediaConvert template:
{
"Name": "Experimental job",
"Settings": {
"TimecodeConfig": {
"Source": "ZEROBASED"
},
"OutputGroups": [
{
"CustomName": "My audio file group",
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "MP4",
"Mp4Settings": {}
},
"AudioDescriptions": [
{
"AudioSourceName": "Audio Selector 1",
"CodecSettings": {
"Codec": "AAC",
"AacSettings": {
"Bitrate": 96000,
"CodingMode": "CODING_MODE_2_0",
"SampleRate": 48000
}
}
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "my-output-bucket",
"DestinationSettings": {
"S3Settings": {
"StorageClass": "STANDARD"
}
}
}
}
}
]
},
"AccelerationSettings": {
"Mode": "DISABLED"
},
"StatusUpdateInterval": "SECONDS_60",
"Priority": 0,
"HopDestinations": []
}
And my MediaConvert parameters:
{
"Queue": MY_MEDIA_CONVERT_QUEUE_ARN,
"JobTemplate": "Experimental job",
"Role": MY_MEDIA_CONVERT_ROLE_ARN,
"Settings": {
"Inputs": [
{
"AudioSelectors": {
"Audio Selector 1": {
"Offset": 1,
"DefaultSelection": "NOT_DEFAULT",
"ProgramSelection": 1,
"SelectorType": "TRACK",
"Tracks": [1]
}
},
"VideoSelector": {
"ColorSpace": "FOLLOW"
},
"FilterEnable": "AUTO",
"PsiControl": "USE_PSI",
"FilterStrength": 0,
"DeblockFilter": "DISABLED",
"DenoiseFilter": "DISABLED",
"TimecodeSource": "EMBEDDED",
"FileInput": "my-input-file"
}
]
},
"UserMetadata": "mymetadata"
}
I've tried adding an InputGroup which looks like this to my template, but it doesn't help:
"Inputs": [
{
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT",
"SelectorType": "TRACK",
"AudioDurationCorrection": "TRACK"
}
},
"TimecodeSource": "ZEROBASED"
}
]
What should I do differently?
Edit: I found that when using ffmpeg to transcode the file from mka to mp3 on the command line, I had to use the option -af aresample=async=1
, as per this answer: https://stackoverflow.com/a/52847587/3310775. Doing this resulted in an output file of the correct length. But what MediaConvert setting does this correspond to?
Edit: I would also accept settings to accomplish this using AWS Elastic Transcoder.
MediaConvert
may remove silent audio tracks from the output video, which can cause the output video to be out of sync with the audio from its audionormalization
feature - possible workaround to prevent this behavior setaudio normalization algorithm to ITU-R BS.1770-4
and the correction type toMEASURE_ONLY
& also theaudio normalization
feature ofMediaConvert
supports theITU-R BS.1770-1, -2, -3, and -4 standard algorithms
, and allows the selectedalgorithm
to only produce loudness measurements. It also allows logging loudness levels and storing these logs inS3
.Modify template to include the
audio normalization
settings under theAudioDescriptions
section-50 dB,
the track is considered silent and may be removed byMediaConvert
.ffmpeg
, or use another service likeAWS Elastic Transcoder to mp4 or mp3
.latter does not have theaudio normalization
feature, so it should preserve the silent audio tracks in your output file.reference to comments :
elastic Transcoder settings
can be triedAudio Bitrate:
increase the audio bitrate to ensure that there is enough data to preserve the quiet parts of the audio. These can be tried . There is no doc say that they worked . Also take a look hereOther things to try with Audio that offered by it that might preserve the audio. See which works !