Audio gap when combining dash cam clips

I’m trying to use Shotcut (v23.12.15) to combine dash cam MP4 clips together. When I drag two clips into a blank timeline, they sequence up back-to-back as expected. The video appears to transition perfectly. However, there appears to be an audio dropout right at the transition from clip 1 to clip 2.

When I look at the timeline, at the audio part, I see what looks like a missing piece right at the end of clip 1.


If I export the project untouched/modified, and play back the resulting file in VLC, I can hear what I think is a 1 frame audio silence or gap while the video plays perfectly during that transition.

I double-checked this by using the MP4Tools “Joiner” app to combine the clips. The resulting combined file, when played in VLC, looks and sounds perfect - no hiccups at all.

What am I doing wrong here? Am I missing some Shotcut setting that would affect the audio between clips like this?


Update: Out of curiosity, I brought the 3 minute clips into Audacity, and the audio tracks end 0.032 seconds before the 3 minute mark. Is this normal/correct? (I’m a bit confused now.)

Your screenshot shows a few frames or more of where you have no audio.

Keep in mind that you may be working with variable frame rate video. Shotcut only encodes to a constant frame rate.

Does your Video Mode FPS match your dash cam clips? Mismatched FPS can offer mismatched results in audio and video.

To check your Video Mode, click on Output, then Properties.
To check your Dashcam videos click on the clip, then Properties.

The time code in Shotcut is HH:MM:SS:FF (FF=Frames relating to Video Mode FPS)

So the clips are:


The audio is 1 channel, 16 kHz, AAC, fltp.

The Video Mode was set to “Automatic”. Just to be sure, I set it specifically to match the clips. I also made sure the Audio Channels was set to 1. Didn’t make a difference.

Also, in my first post, the picture shows the audio drop out on the last frame of clip 1.

It might be. The reason is because of the packaging.

An AAC audio frame is 1024 samples. At 16KHz, that means each audio frame is 1024 / 16000 = 64.125ms

A video frame is 1/frame rate. At 30fps, each video frame is 1 / 30 = 33.33ms

If your files are 3 minutes, the video is simple: 30fps x 60 seconds per minute x 3 minutes = 5,400 video frames. But the audio is not simple: 16,000 samples/second * 60 seconds per minute x 3 minutes / 1024 samples/frame = 2,812.5 audio frames.

In your files, audio frames are not the same duration as video frames - they do not start and stop at the same time. In each file, the encoder probably starts the file with a fresh audio and video frame starting at 0.00 seconds. But what should it do at the end when they do not align? It cant package part of a frame. So it probably fits as many audio frames as it can until the last video frame and then just leaves the rest of the audio “empty”. 2812 audio frames fit. But that last 0.5 audio frames is lost. And it just so happens that 64.125 / 2 = 0.0320625 seconds.

This behavior is not uncommon in my experience.

Okay, that makes sense!

So if I’ve got my calculations correct, I should change my dash cam’s setting to 2 minute clips in order for the AAC frames to be an integer value. I’ll try that and report back the results.

Thanks Brian!

Well this is frustrating. :confused:

I set my dash cam to 2 minute recordings, but when I import them into Audacity, the audio appears to end 0.064 seconds before the 2 minute mark.

Importing the new clips into Shotcut, I’m still hearing the 1 frame audio drop.

On a hunch, tried this with another popular video editor and I’m getting the same results. So I’m pretty certain that the dash cam clips themselves are faulty, not Shotcut.

At this point I’m going to guess that the camera itself cuts off the audio on the last frame of each clip no matter what the length is. I’ll need to ask the dash cam company about this.

Thanks for the help everyone!

You could always snip off the last frame of video from each clip.

Unfortunately that causes a 1 frame video glitch. :frowning:

If you drag one clip back over the other a crossfade transition would occur and probably make the flow smooth from clip to clip.

If perfect audio accuracy is not needed but just to fix the annoying audio drop, have you tried the Track auto fade or Track seam filters?

Just did.

The Track Auto Fade Audio made the audio drop more noticeable IMHO. I tried different fade durations. Longer durations smoothed the pop/click nature of the audio drop, but made it stand out more, especially if the audio is loud (like music or a conversation). Shorter durations didn’t seem to help.

As for the Track Seam, I couldn’t really hear any difference no matter what value I set the Discontinuity Threshold to. (I tried 0.0 to 20 dB, still heard the audio drop.)

This topic was automatically closed after 90 days. New replies are no longer allowed.