Audio distorted and delayed

We’ve been trying to add audio to the beginning of a video but we run into two problems:

  • The audio gets distorted in the beginning (sounds like it plays the first bit twice)
  • The audio gets delayed by a fraction of a second, not always the same time.

This is what I’ve tried:

  • When I set a soundtrack on the timeline instead of using an audio asset, the audio wasn’t distorted, but it still got delayed.
  • When I used longer audio from a third party, it again wasn’t distorted, but I can’t see what’s wrong with the audio file I want to use. But again, still delayed by a fraction of a second.
  • When I exported just the first three seconds, using an audio asset and not a soundtrack, it again wasn’t distorted, but still was delayed and now delayed more than before.

Is this a known problem? Are there any suggestions to solve this? Here is an example where you can hear the distorted double drum beat in the beginning: https://shotstack-api-v1-output.s3.ap-southeast-2.amazonaws.com/ksjscuvabj/5d1f063e-5768-480b-b8d4-6b1bd3f27706.mp4

Was able to reproduce this error. We’re taking a closer look at this and get back to you.

If you set the audio start time to 0.04 (the first frame) and remove 0.04 off the length, that seems to work. Can you try that and let us know if the audio sounds right to you?

I faced a similar problem, which I’m trying to make a perfect loop for a video, but the audio is delayed at the start of the video. I didn’t applied any trim to the audio, and the start is set to 0. I also tried to used the audio as Soundtrack not AudioAsset, but same problem occurs. Any comments on this?

Here is the simplified code I used:

{
    "timeline": {
        "tracks": [
            {
                "clips": [
                    {
                        "asset": {
                            "type": "audio",
                            "src": "https://shotstack-ingest-api-stage-sources.s3.ap-southeast-2.amazonaws.com/ijje6s0jyl/zzyahj3b-3ali-bd1l-bp0z-1ml5vg0l7x5o/source.mp3"
                        },
                        "start": 0,
                        "length": 30.84
                    }
                ]
            }
        ]
    },
    "output": {
        "format": "mp4",
        "size": {
            "width": 576,
            "height": 1024
        }
    }
}

Here is the production result:
https://shotstack-api-stage-output.s3-ap-southeast-2.amazonaws.com/ijje6s0jyl/35551efa-873f-4282-84ae-07760da4e185.mp4

Here is a picture showing the delay:


Blue one is the generated video, whereas green one is the original audio I used. You can see some blank audio is filled at the start of the video (as circled in red).

Bump on this, why is it happening?

Hello @michael1, @jason. I will look into this and get back to you shortly.

Would love an update as this is happening to my customer’s videos