Audio gets distorted after trimming the beginning of a video

Operating System: Windows 10, 20H2. compilation 19042.1348, with the Windows Feature Experience Pack 120.2212.3920.0.

Shotcut version: 64 bits. Portable. 21.10.31. But the same problem it happens with the portable version 21.03.21. It also happens with an installed version (I can’t remember the version, but it was a 2021 one).

Problem: After trimming a few seconds of the beginning of a video fragment, the audio gets distorted. The distortion lasts a few seconds, and sometimes it also appears in other parts of the same video fragment. When I say “distorted” I mean that a few miliseconds of the audio disappeared or are repeated (like an echo), turning the audio unusuable and very difficult to understand. It looks like if there was some kind of problem with the microphone cable (I can confirm that the video fragment had no audio problem at all). When I undo the trimming, sometimes the problem disappears, and sometimes it does not. This distortion can be heared inside the very Shotcut and in the exported video file.

Repetition: The problem has appeared several times. Indeed, it appears each time I repeat this trimming operation on the same kind of video files.

Video fragment properties: Windows Media Video 9, yuv420p, 1920x1080, data rate 3893 kbps, 30 fps. Audio Codec Windows Media Audio 2, stereo, 44.1 Khz, fltp.

Laptop: Lenovo E15, i7-10510U, 16 GB RAM.

Thank you for your time.

If the clip is converted to edit-friendly, does the problem still happen? WMA is not a seek-accurate audio format.

1 Like

Hi Austin,

Can the edit-friendly conversion be done manually? I thought it was something automatic offered by Shotcut. So, the answer to your question is: I don’t know. Shotcut did not offered that conversion to me.

Yes. Here is a screenshot showing where to find it:

1 Like

Because you have said it to me. If not, I would still be looking for that option. Thank you.

I have just converted the video using “the best” option (and the heaviest) and the resulting converted video has the right audio when I play it using the VLC. But when I import the converted video using Shotcut (and without adding it into the timeline), the audio suffers from the same problem.

In preview only?

1 Like

I suggest to try to export a video. If the distortion occurs in the Shotcut player, but not in the exported file, then you are experiencing preview lag - which is common and does not affect your final project output.

1 Like

Hi all,

Exporting the video is a good point. I have repeated the operations, but now I have also exported the video, and the result is… well, I don’t understand the result. I will try to explain it:

After repeating the same steps (importing the converted video and trimming a few seconds of its beginning), and in preview mode, the problem disappeared. The audio was right. Then, I undid the trimming and, when I replayed in preview mode, several seconds of the audio were affected again. In addition, I exported the video, and the audio was again right. But that is not all.

After exporting the video, I came back to Shotcut and I replayed it in preview mode. The audio was wrong. Then, I started writing this message and, after a couple of minutes, I replayed the video again in preview mode, and now the audio was right.

It is a problem that appears and it disappears.

So, I decided to close Shotcut, I run it again and I imported the converted video. This time without trimming anything. The first time that I played it in preview mode, the audio was wrong. After rewinding, I played it again and the problem disappeared.

The last thing I have done it has been pressing the pause button, pausing and resuming the video in preview mode. I have discovered that, after pausing and resuming, the audio is wrong. If I rewind the video completely and I played it again, the audio is right. If I play, pause and resume the video again, the problem appears. Then I exported the video and I played it using VLC. The audio was right.

I have no idea what is happening.

This is what really matters. It confirms that the original WMA file had seek accuracy problems since an export from WMA originally didn’t work. “Convert to Edit-Friendly” will be a necessary step if continuing to use WMA files.

It means your computer is struggling to play these large video files. When playing a section of video, Shotcut can’t decode video fast enough (or the hard drive can’t supply data fast enough), and the audio glitches as a result. However, if the same section is played again, the video is likely coming out of the frame cache in RAM and will appear to work fine until playback reaches a part of the video that isn’t in cache. Then the glitching starts again.

If the data rate from the hard drive is part of the problem, then this can be reduced by using the “Medium” option of Convert to Edit-Friendly. You will be unable to tell a visual difference in quality compared to High.

If that doesn’t provide a full fix, then Proxy files and Preview Scaling are the usual solutions.

1 Like

Thank you very much for your help. I will take into account your advices in future works. Besides, I will try to avoid the WMV / WMA formats, since they look like problematic. If I can’t avoid them, I will convert them into an edit-friendly format.

May I offer a suggestion? I think that it would be a good idea to show some information on the screen when a user loads a WMV video or WMA audio, so that he/she can be informed about how problematic they can be. Or even better, Shotcut may offer the possiblity of converting them into an edit-friendly format.

Regards.

I have used ShotCut for hundreds of YouTube videos and solved my audio distortion problems by:

  1. Editing all my video before adding my music.
  2. Muting the sound in the video.
  3. Editing the sound in Audacity to be slightly shorter than the video.
  4. Being careful to not cut the sound of the music in the middle of the music. I only cut the end or the beginning of the sound in audacity. Cutting in the middle causes distortion even though small.
    5.I use the Fade In at the beginning of the sound if the sound is too abrupt. I cut the beginning or end of a song to fit the length of my video (actually slightly shorter than my video - usually less than a second)
  5. I export the sound file from Audacity to my desktop.
    7.I drag the sound file to the playlist in ShotCut.
  6. I add an audio track to the timeline and drag the audio file from the playlist to the time line being careful to adjust the shorter audio file so there is a tiny gap at the beginning of the tract so the sound starts after the video starts. The ending of the audio file I also keep less than the video file.
  7. With practice, I know how much I need to keep the audio file shorter than the video file.
  8. This works for me with music and may not meet everyone’s situation.
4 Likes

Shotcut version 22.09.23
Linux Ubuntu 21.04 LTS, Kernel 5.4.0-128 Generic

I have about a dozen video clips that all look and sound great by themselves. I decided to put them together using Shotcut. The first pass, the cuts sounded great. I added them to the project timeline and they still sounded great. I then saved the project to a new MP4 and it sounds like crap. Now, even playing them in the project timeline also sounds bad. Distorted, scratchy audio. The Forum says this was fixed in 20.07 but I’m at 22.09 and the problem is definitely there. Is there any way to save this project? Any idea what I need to do to avoid this? Thanks in advance.

Did you try all the suggestions in this solved thread? Did any of them have any affect?

If not, it would be good for you to start a new thread since this thread is marked solved.

Yes, I tried various things I read across these pages going back a few years. While some helped a bit, none of them cured the issue completely. I’ll start a new thread.

A codec update appears to have resolved the problem. Also updated libffmpeg.so. Apparently, the problem was NOT with Shotcut. Please close this thread.
Note not all libffmpeg are the same. There are a lot of different ones including Chromium’s, Opera’s, and other application included ones. I picked the biggest one I could locate that was compatible with my OS.

I am not sure this is the same problem, but I get distorted audio when exporting edits from a flac-encoded source (whether generated by Shotcut’s “audio FLAC” export to Matroska .mka or by flac --best on the command line). The distortion is either absent or different when playing in Shotcut itself; the thing that is reliably broken in the same manner is the export via melt, regardless of the audio file end format.

Do melt and shotcut use different means for reading FLAC encoded streams? Or is this just coincidence that goes haywire on certain input sequences, and when exporting I reliably get the same input sequence?

I often run into a sound problem in the shotcut program. I’ve been trying to analyze the source of the problem for a week now. There are video files (especially often found on social networks) that have been compressed by some kind of bad software. I have an example of such a file, where the duration of the video is 2:07 and the audio is 2:07, if this video file is viewed in the “MediaInfo” program. Shotcut also sees this file with a duration of 2:07. This video file plays windows player absolutely fine without distortion, it sounds on my mobile phone without problems, but if you play it in shotcut, then throughout the entire length of the video, the sound will crackle and sound corrupted. If this video file is opened in audacity, its audio track will be 2:11 long.

The only way I’ve found so far to fix this problem without transcoding is a GUI version of ffmpeg - clever FFMPEG-GUI.

    • I am extracting the audio track from this file without transcoding.
    • I add it back through the “multiplex” tool and disable the one that was there.

After that I save the file. I don’t know what kind of magic is happening at this moment, but the file seems to be rebuilt again and already sounds without distortion. I would like to draw your attention to the fact that I did not recode anything, the video and audio streams remained unchanged, the file was essentially rebuilt, and its size only changed slightly.