Dolby Digital AC-3 Crackling at start

Hello,

im getting crackling noises at the start of an exported video with Dolby Digital AC-3 for about two seconds. I saw that there was already a bug with crackling noises at the start in 2019. When I am exporting the video with stereo sound and AAC I get this disturbances too (downsampling 5.1 to stereo).

I am using Windows 10 and the newest Shotcut version.

The source material has following properties (.ts container):
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : CABAC / 6 Ref Frames
Format settings, CABAC : Ja
Format settings, Reference frames : 6 frames
Codec ID : 27
Duration : 1 h 43 min
Bit rate : 13,6 Mb/s
Width : 1 280 Pixel
Height : 720 Pixel
Display aspect ratio : 16:9
Frame rate : 50,000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : progressiv
Bits/(Pixel*Frame) : 0.296
Stream size : 9,84 GiB (89%)
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Audio #3
ID : 6322 (0x18B2)
Menu ID : 11130 (0x2B7A)
Format : AC-3
Format/Info : Audio Coding 3
Commercial name : Dolby Digital
Codec ID : 6
Duration : 1 h 43 min
Bit rate mode : konstant
Bit rate : 448 kb/s
Channel(s) : 6 Kanäle
Channel layout : L R C LFE Ls Rs
Sampling rate : 48,0 kHz
Frame rate : 31,250 FPS (1536 SPF)
Compression mode : Lossy
Delay relative to video : -460 ms
Stream size : 331 MiB (3%)
Service kind : Complete Main

The exported video has following properties (.mp4 container):
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings : CABAC / 3 Ref Frames
Format settings, CABAC : Ja
Format settings, Reference frames : 3 frames
Format settings, GOP : M=4, N=25
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1 h 35 min
Bit rate : 2 835 kb/s
Width : 1 280 Pixel
Height : 720 Pixel
Display aspect ratio : 16:9
Frame rate mode : konstant
Frame rate : 25,000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : progressiv
Bits/(Pixel*Frame) : 0.123
Stream size : 1,89 GiB (86%)
Codec configuration box : avcC

Audio
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Commercial name : Dolby Digital
Codec ID : ac-3
Duration : 1 h 35 min
Bit rate mode : konstant
Bit rate : 448 kb/s
Channel(s) : 6 Kanäle
Channel layout : L R C LFE Ls Rs
Sampling rate : 48,0 kHz
Frame rate : 31,250 FPS (1536 SPF)
Compression mode : Lossy
Stream size : 306 MiB (14%)
Service kind : Complete Main
Default : Ja
Alternate group : 1

I am using following Shotcut settings for the export:
vpre=medium
preset=medium
movflags=+faststart
f=mp4
acodec=ac3
channels=6
ar=48000
ab=448k
vcodec=h264_qsv
qscale=18
g=25
bf=3
top_field_first=2
deinterlace_method=yadif
rescale=hyper
threads=3

I hope that are all necessary information.

Can you please post a screenshot of your “About” screen? (Help->About Shotcut)

.ts files are difficult for frame seeking and can be prone to error. Perhaps the crackling is caused by poor seeking. Does the problem persist if you perform “Convert To Edit Friendly” on the source file and then export the converted file?

image

Hello,
here is the requested screenshot:


I didn’t try the “Convert To Edit Friendly” option yet. I would like to avoid this, as it would require an additional time consuming conversion.
But I tried it with the .mkv container for the source media (video and audio stream copied with XMedia Recode). But this has not made any difference.

Would it be possible to provide a short clip and simple step-by-step instructions (or an example project) to allow someone else to reproduce the issue?

Hello,
here is a short example with a project and my used export settings:

Testing on Windows, I don’t even need to export to experience the crackling. I can hear it in the Shotcut preview when playing it. The crackling only happens in the 5.1 channel stream right after the scene change. The 2 channel track does not experience the crackling. Also, I do not year the crackling in windows media player or VLC when I listen to the same track.

When I do export the file, I see many messages about timestamps:

WILD TIMESTAMP: pkt.pts=[-9223372036854775808], pkt.dts=[-9223372036854775808], req_position=[1109], current_position=[1069], int_position=[0], pts=[-9223372036854775808]

My best theory right now is that Shotcut has some difficulty seeking in the file due to something incompatible with the timestamps.

If I convert to edit friendly, the problem also occurs with the converted file. This supports the timestamp theory since timestamps are passed through when the file is converted.

Unfortunately, I don’t have any ideas for a workaround.

Can I do anything to help solving the problem? I tested the current version 21.01.29 and it is showing the same behaviour.

Without needing to use other software, I think I found a way to make that work without any problems on Shotcut (I just don’t know if it produces lossless audio).

Try the following:
Export from the source as an audio file.
Make sure to choose in the audio export tab, the 5.1 stream and the bitrate that matches your file (in this case it is 448 kb/s).

In my example, this produces a 6-channel (5.1) . WAV file.
Add that WAV file to your project as a new audio track.
Mute the audio from the V1 video track.


I think that might work for you.

I did further research on this strange behaviour and although I don’t have enough knowledge I found this:
The imported 2-channel audio track has a longer duration and seems clearly out of sync.
The information extracted from the source video indicates:
On audio track 1 (2ch) a delay relative to the video of -778 ms.
On audio track 2 (6ch) a delay relative to the video of -800 ms.


Comparing the audio track of the source video and the extracted WAV audio, the duration matches but the waveform is different from the beginning of the Universal fanfare.

And if I choose both audio streams from the source video, I find that the waveform is identical from the beginning of the Universal music, all the way to the end (minus the extended bit).


Is it possible that during the broadcast of the advertisement, there was a 2-channel broadcast and that starting the film on 5.1 channels produces this effect? I ask this from my lack of knowledge.

2 Likes

The analysis from @ejmillan above is excellent and supports my test below…

I was suspicious of the “WILD TIMESTAMP” message that I posted above. In my experience, it is not uncommon for broadcast streams to have discontinuities in the timestamps due to reception issues or multiplex level switches. So my theory is that the source file has some timestamp gaps or discontinuities.

To test this theory, I extracted the audio and placed it on a separate file (similar to what @ejmillan did above). But in my test, I used ffmpeg to extract the raw ac3 data into a separate file:

ffmpeg.exe -i Test.mkv -map 0:2 -acodec copy -vn test_audio.ac3

Then, I put the original file on track 1 and muted it. I put the extracted audio file on track 2.

In this configuration, the audio crackling does not occur.

Unfortunately, Shotcut depends heavily on accurate timestamps in the source file to ensure that each edit is frame accurate. Perhaps we could work on making Shotcut more tolerant of timestamp issues - but that would risk causing a regression in seeking accuracy. So I do not think it will become a priority.

Thank you @Brian for your consideration of my analysis.:heart_eyes:
I don’t know anything about FFmpeg commands, but I do use software that uses FFmpeg for importing audio from a video source.
Not only Shotcut has problems with this audio-video source.
Yesterday I did an import of the audio (6 ch), from the video sample, in Audacity and I already saw that there was something wrong there too.

Note how the duration of the first two channels is longer than the rest.
The audio of a movie (with 5.1 channel audio) should look like this screenshot.

Not only Shotcut, incorrect timestamps are an problem for all video editors and also for mediaplayers.
I am also using Shotcut to edit recordings from television broadcast stations (directly captured DVB-S transport-streams from satellite) so i know this problem.
This streams can contain a lot of potential sources of errors like incorrect timestamps, an overflow of the timestamps (pts overflow), reception disorders, reconfiguration of the multiplex with change of the aspect ratio, video mode or the audio format… The additional data in this streams (DVB-SI-data for program info, teletext, etc…) can also make problems.
So it is highly recommended to check (continuous numbering and checksum of the individual data packets) and remultiplex this transport-streams with an tool which is suitable for this task before editing them with Shotcut or an another editor.
From the tools i know the best one suitable for MPEG-2 SD-streams is the open source tool “Project X” which is written in Java and works on all operating systems where an JRE is available.
For HD-streams with h.264 or h.265 video Project X is not suitable and i don’t know any free software for this work. Ther is only an commercial software from Cypheros called “TS-Doctor”.

Hello,
thank you Brian, ejmillan and Loger, for the detailed analysis of the problem. I will use the workaround to export the audio file and import it afterwards.

Thank you very much

It would be great to know if you finally got the expected results and what solution you applied. That may be helpful to other users with a similar problem.
Best regards and good luck.:wink:

I first export (no encoding just copy) the Dolby Digital audio track from the source file with XMedia Recode, a ffmpeg based converter. After that i import this audio file in shotcut and mute the audio on the video track. Then I edit and export like normal.
With this workflow I don’t have the crackling audio.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.