MTS video files with AC-3 Dolby Digital - loudness issue

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

Quake94

  • Posts: 3
  • Joined: Mon Dec 26, 2022 5:31 am
  • Real Name: Jacob Smith

MTS video files with AC-3 Dolby Digital - loudness issue

PostMon Dec 26, 2022 5:52 am

Hello All,

I am running into problem with preserving audio quality using Resolve 18.1.2. All I am doing in my project is joining multiple clips together with short transitions, trimming a couple clips and adding a subtitle intro. No additional video or audio edits. All videos are from the same source - a handycam Sony HDR-PJ710V. The audio is recorded in AC-3 5.1 Dolby Digital, in an .MTS format.

The audio from imported MTS video file seems to have a lot of loudness compared to original source file. The sample video file has a moment with a water splash in the 5th second, and it lost "crispness", in favour of background noise having greater gain. I am not sure if those are the right terms, and will attach sample output. I did not make any adjustments to audio or add effects in Fairlight or elsewhere.

I have replicated the issue in Adobe Premiere Pro 2023 as well.

MediaInfo:
General
ID : 0 (0x0)
Complete name : D:\00138.MTS
Format : BDAV
Format/Info : Blu-ray Video
File size : 36.3 MiB
Duration : 25 s 23 ms
Overall bit rate mode : Variable
Overall bit rate : 12.1 Mb/s
Maximum Overall bit rate : 18.0 Mb/s
Recorded date : 2016-09-03 16:18:24-04:00
Writing application : Sony HDR-PJ710V

Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : CABAC / 2 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 2 frames
Format settings, GOP : M=2, N=15
Codec ID : 27
Duration : 24 s 958 ms
Bit rate mode : Variable
Bit rate : 11.2 Mb/s
Maximum bit rate : 16.0 Mb/s
Width : 1 440 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 29.970 (30000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan type, store method : Separated fields
Scan order : Top Field First
Bits/(Pixel*Frame) : 0.240
Stream size : 33.3 MiB (92%)
IrisFNumber : 4.000000

Audio
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Commercial name : Dolby Digital
Codec ID : 129
Duration : 25 s 56 ms
Bit rate mode : Constant
Bit rate : 448 kb/s
Channel(s) : 6 channels
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 : -67 ms
Stream size : 1.34 MiB (4%)
Service kind : Complete Main

Text
ID : 4608 (0x1200)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 24 s 459 ms
Delay relative to video : -67 ms


Sample output PCM audio:

test audio 5.1 film PCM 16bit.mov
https://drive.google.com/file/d/1q_CYQN ... share_link

Original extracted audio:

00138_1_A_extracted.ac3
https://drive.google.com/file/d/16ScImD ... share_link

Original video:

00138.MTS
https://drive.google.com/file/d/1TaUube ... share_link


What I tried already:

I extracted individual channels to .wav files by running:

Code: Select all
ffmpeg -i 00138.MTS -filter_complex "channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]" -map "[FL]" front_left.wav -map "[FR]" front_right.wav -map "[FC]" front_center.wav -map "[LFE]" low_frequency_effects.wav -map "[SL]" back_left.wav -map "[SR]" back_right.wav


I confirmed that when I manually add the extracted .wav audio files to Resolve, the audio quality matches the source video file - it has that "crispness" of water splash in the 5th second.

Screenshot of waveforms, on the left are the Resolve's detected audio tracks, on the right are the added extracted .wav files:
Image

Steps to replicate:
[list=]- I added the 00138.MTS to Media Pool
- I right click it, select Create new timeline using selected clips, 1 video, 1 audio track, based on selected media
- I go to Fairlight or Edit mode, and see all 6 audio tracks, all with the "noisy" waveforms[/list]

When I playback in "Edit" section and look at Mixer A1, roughly there is a ~10dB difference between the "noisy" Resolve-detected ones, and the .wav extracted which match original video. The Resolve one will bounce around -20 to -10 dB , while the .wav will be around -30 to -20 dB

I went to Fairlight, selected the 6 Resolve tracks and selected to analyze audio levels to ITU-R BS1770-1, then I did the same for .wav extracted files.

Resolve audio tracks are: -16.8 dBFS and -34.6 LUFS
Extracted audio tracks are: -13.4 dBFS and -39.8 LUFS

I also run this command

Code: Select all
ffmpeg -i input_file -filter:a ebur128 -map 0:a -f null -


Which is supposed to analyze loudness of audio.
When I compare result at lets say, second 2.09998, here is the difference:

Original 00138.MTS:

Code: Select all
[Parsed_ebur128_0 @ 000001baee788500] t: 2.09998 TARGET:-23 LUFS M: -30.8 S:-120.7 I: -28.4 LUFS LRA: 0.0 LU


Resolve's output with PCM audio:

Code: Select all
[Parsed_ebur128_0 @ 00000206effbd2c0] t: 2.09998 TARGET:-23 LUFS M: -20.6 S:-120.7 I: -18.5 LUFS LRA: 0.0 LU


Based on that, there is like 10 dB difference in LUFS, among around 10dB difference in "M" metric, whatever that is.

I have also attempted to manually adjust the gain to -5.2dB, I have also tried various normalization methods but none of that helped me to match the Resolve audio tracks to the original audio source.
This results in Resolve outputting a much worse audio quality with a lot of loudness (or noise).

Is this a bug, or are there some steps I need to take to preserve the source audio quality?
Offline

Reynaud Venter

  • Posts: 6358
  • Joined: Sun May 28, 2017 9:34 am

Re: MTS video files with AC-3 Dolby Digital - loudness issue

PostMon Dec 26, 2022 3:56 pm

The source and extracted audio media True Peak and Loudness levels are identical. Deliverables created via the Deliver page with Timeline Track selected as the Output Track retains source levels.

Ensure that the audio level analysis in Resolve uses a single source stream rather individual channels.
Fairlight Studio Console 3 Bay • Merging Hapi • Anubis • Merging Premium VAD (3.5.0) ↔︎ Lawo VSC (1.0.0)
Mac Pro 7,1 Rack • Resolve Studio 20.0 • macOS 15.5 (24F74) ➩ 11" iPad Pro (M4) 1TB • iPadOS 18.5 (22F76)
Offline

Quake94

  • Posts: 3
  • Joined: Mon Dec 26, 2022 5:31 am
  • Real Name: Jacob Smith

Re: MTS video files with AC-3 Dolby Digital - loudness issue

PostTue Dec 27, 2022 1:26 am

Thank you for reply.
I just wanted to clarify (and if I understand you correctly), that yes - the audio volume/loudness is preserved within Resolve throughout processing. The audio tracks that Resolve generates on import match the output file. However, the generated import tracks do not match the source file's.

The primary issue I am dealing with is that the imported .MTS video file does not sound the same within Resolve (and after export) right off the start, as compared to the source file.

When I try to match gain by dragging the white line to roughly -5.4 dB adjustment, and set the track next to a matching ffmpeg .wav track extracted from source file, I can see difference in waveforms, and not just the volume but actual distortion like trimmed peaks and different curves which may suggest that Resolve isn't decoding the audio tracks correctly on import.

I am not an expert, but the simplest way to explain my issue is to listen to source file as imported in Resolve, and then to the source file played back elsewhere. In roughly 5th second there is a distinct water splash. The source file overall sounds quieter and the water splash sounds very detailed. In Resolve it is almost as if the source audio channels were compressed and gain-boosted, making it sound very flat, followed by loud background noise. This poor quality remains after exporting, so it is not a preview rendering issue, but maybe something related to how Resolve decodes source file audio tracks.

Here is a better picture. Here, the Analyze window shows loudness for the .wav track on the right, for Front Left channel.
I adjusted the gain of the Resolve's track by -5.4dB as shown.
Despite that, there is an obvious difference in waveform, with the Resolve's indicating increasing volume curve (which is very obvious to hear during playback), as compared to the .wav track.
Image

Just to clarify, I am comparing the correct channels.

Here are the summaries from the ffmpeg's ebur128:

Source file 00138.MTS
Code: Select all
[Parsed_ebur128_0 @ 000001e840e08500] Summary:

  Integrated loudness:
    I:         -30.7 LUFS
    Threshold: -40.7 LUFS

  Loudness range:
    LRA:         4.9 LU
    Threshold: -50.9 LUFS
    LRA low:   -33.2 LUFS
    LRA high:  -28.3 LUFS


Output Resolve file, PCM audio:
Code: Select all
[Parsed_ebur128_0 @ 000001ff16c5d2c0] Summary:

  Integrated loudness:
    I:         -22.1 LUFS
    Threshold: -32.1 LUFS

  Loudness range:
    LRA:         3.6 LU
    Threshold: -42.5 LUFS
    LRA low:   -24.5 LUFS
    LRA high:  -21.0 LUFS
Offline

Reynaud Venter

  • Posts: 6358
  • Joined: Sun May 28, 2017 9:34 am

Re: MTS video files with AC-3 Dolby Digital - loudness issue

PostTue Dec 27, 2022 6:03 am

Is this on a macOS, Windows, or Linux system? Resolve Standard (free) or Studio?

Do source and output True Peak and Integrated levels match when converting the source to LPCM via FFmpeg?
Fairlight Studio Console 3 Bay • Merging Hapi • Anubis • Merging Premium VAD (3.5.0) ↔︎ Lawo VSC (1.0.0)
Mac Pro 7,1 Rack • Resolve Studio 20.0 • macOS 15.5 (24F74) ➩ 11" iPad Pro (M4) 1TB • iPadOS 18.5 (22F76)
Offline

Quake94

  • Posts: 3
  • Joined: Mon Dec 26, 2022 5:31 am
  • Real Name: Jacob Smith

Re: MTS video files with AC-3 Dolby Digital - loudness issue

PostTue Dec 27, 2022 10:46 pm

I am using Windows 11, replicated the issue on both free and Studio version of Resolve, the issue has been present in the previous versions too. I am also using a codec pack K-Lite Mega, but not sure if this matters - I would imagine Resolve has its own built-in codecs. I am quite certain this issue can be replicated on any machine. My original post has the source video and extracted audio available for testing.

Do source and output True Peak and Integrated levels match when converting the source to LPCM via FFMPEG?


The extracted .wav files that I have for each channel from FFMPEG are in PCM 16bit format. The source video file has audio in AC-3 format which I believe is a single container holding multiple channels. Extracting audio track from source video file results in a single .ac3 file (00138_1_A_extracted.ac3) that Resolve imports as 5.1 Film single stream with multiple individual channels.

Nonetheless, when I playback just the imported .ac3 file in Resolve, it has the same issue as when importing a complete video file. The same .ac3 file played back in MPC or elsewhere sounds correct.

As shown in the screenshot in my previous post, I suspect there is some waveform distortion happening when Resolve processes .ac3 stream. I am starting to doubt this is simply a loudness issue for three reasons:
- Normalization or manual adjustment of gain does not solve the issue
- There are obvious differences in waveform structure between Resolve's tracks and the ffmpeg PCM .wav extracted tracks
- Imported .ac3 audio stream or video file by default before any kind of processing sounds incorrect as compared to playing it elsewhere

Here is some more data:
Resolve BS.1770-4 values on the imported .ac3 file (all channels):
True Peak: -4.4 dBFS Loudness: -21.5 LUFS

FFMPEG command ran on the same file, added flag to calculate True Peak:
Code: Select all
ffmpeg -nostats -i 00138_1_A_extracted.ac3 -filter_complex ebur128=peak=true -f null -

Result:
Code: Select all
[Parsed_ebur128_0 @ 000001d0717167c0] Summary:

  Integrated loudness:
    I:         -30.7 LUFS
    Threshold: -40.7 LUFS

  Loudness range:
    LRA:         4.9 LU
    Threshold: -50.9 LUFS
    LRA low:   -33.2 LUFS
    LRA high:  -28.3 LUFS

  True peak:
    Peak:       -5.6 dBFS

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], dziedrius, Roger the Grey and 186 guests