View Full Version : [Release] PowerShell Scripts for FFmpeg 8.1 - Convert 7.1 Audio to DDP 5.1
Kaisen
25th April 2026, 16:51
GitHub repo:
https://github.com/pkho-user/audio-engine
Overview:
Video is always passed through untouched — no video re‑encoding.
ConvertAudioEngine-DDP51.ps1 Features:
- Downmixes AAC 7.1, EAC3 7.1, and TrueHD 7.1 to DDP 5.1 (1024k)
- Downmixes 7.1 > 5.1 using an ITU-based pan matrix
- Re-encodes 5.1 audio to DDP 5.1 (768k)
- Encodes stereo audio to DDP 2.0 (256k)
- Handles TrueHD layout parsing, negative PTS, and mux-queue saturation
ConvertAudioEngine-Keep71.ps1 Features:
- Retains TrueHD 7.1 and AAC 7.1 audio tracks
- Adds a DDP 5.1 (EAC3) compatibility track for universal playback
- Downmixes all other > 5.1 audio to DDP 5.1 (1024k)
- Re-encodes 5.1 audio to DDP 5.1 (768k)
- Encodes stereo audio to DDP 2.0 (256k)
- Handles TrueHD layout parsing, negative PTS, and mux-queue saturation
Both scripts support:
- PowerShell 7.6
tebasuna51
26th April 2026, 12:18
I agree with the idea of converting the obsolete 7.1 2D format to 5.1.
However, I disagree with the downmix formula:
pan=5.1|FL=FL|FR=FR|FC=FC|LFE=LFE|BL=BL+0.707*SL|BR=BR+0.707*SR
This doesn't prevent clipping peaks or transmitting the full volume.
I still recommend adding rear and side channels with high-volume clipping protection.
I've tried tracks 5.1.2 with varying results; the documentation doesn't specify how it handles them.
PatchWorKs
26th April 2026, 21:30
@Kaisen: I'll probably fork your scripts (note: why PS ? CMD is enough, IMHO) for a stereo version instead.
Kaisen
26th April 2026, 22:30
Hey tebasuna51, thanks for pointing that out — you're right that the pan filter alone can still create clipping if BL and SL peak at the same time.
I’ve updated the script so the downmix still uses the same formula, but now there’s a limiter right after it (set to 0.948.):
alimiter=limit=0.948:attack=5:release=50:level=disabled
That way the full volume is kept, but anything that would clip gets caught before it reaches the encoder.
This applies to all 7.1 > 5.1 paths now (AAC 7.1, TrueHD 7.1, DTS‑HD MA, PCM/FLAC, EAC3 7.1).
Thanks again — that was a good catch.
---
Sure, Patchworks — feel free to fork it. I used PowerShell because it handles paths a bit cleaner, but CMD works fine too.
Kaisen
8th May 2026, 20:21
The GitHub repo has been refreshed with four new PowerShell 7.6 / FFmpeg 8.1 scripts:
- AudioPeakRMSChecker.ps1 — new peak/RMS/crest analyzer
- AudioRemove-AC3.ps1 — pure remux AC3/E‑AC3 remover (strict‑mode safe)
- ConvertAudioEngine-DDP51.ps1 — upgraded to PS 7.6 and improved stability
- ConvertAudioEngine-Keep71.ps1 — upgraded to PS 7.6 and improved stability
All four scripts now have full documentation.
Repo:
https://github.com/pkho-user/audio-engine
Kaisen
18th May 2026, 21:39
Release: ConvertAudio2-Stereo.ps1
Downmixes all 7.1 / 5.1 / Atmos audio tracks to high-quality 2.0 stereo (EAC3 or Opus).
Full documentation with rule tables, and technical notes is available on GitHub.
What’s New
- Safe Peak Normalizer(spn) scanning: measures true peak levels and applies normalization only when required.
- PreTrack-QRS: selects the best multichannel source using quality, resolution, and scoring.
- Improved downmixing: ITU‑R BS.775 coefficients for accurate 5.1/7.1 → 2.0 downmixes.
- Limiter stage added for post-downmix peak control.
- Selectable stereo codec: EAC3 or Opus
- Adjustable bitrates for both codecs (within the script)
-
tormento
19th May 2026, 12:33
I agree with the idea of converting the obsolete 7.1 2D format to 5.1.
Ok but the process is lossy, isn't it?
Kaisen
19th May 2026, 16:53
Hi Tormento,
Only the encoded tracks are lossy.
Passthrough tracks remain lossless.
The script never re‑encodes anything that should stay bit‑perfect.
-
tormento
19th May 2026, 18:13
Only the encoded tracks are lossy.
Hi Kaisen.
If so, I prefer to keep them untouched and let the player decide the best strategy ;)
Kaisen
19th May 2026, 19:05
Hi Tormento,
I actually built these scripts for my own personal library, because most of my MKVs have TrueHD 7.1 or AAC 7.1 as the main track and AC-3 as a secondary track. I just needed a reliable way to remove the AC-3 and create a proper downmix from the 7.1 sources.
-
tormento
20th May 2026, 14:17
I actually built these scripts for my own personal library
Thanks for you work! I appreciate it too.
raquete
22nd May 2026, 04:39
I agree with the idea of converting the obsolete 7.1 2D format to 5.1.
However, I disagree with the downmix formula:
pan=5.1|FL=FL|FR=FR|FC=FC|LFE=LFE|BL=BL+0.707*SL|BR=BR+0.707*SR
This doesn't prevent clipping peaks or transmitting the full volume.
I still recommend adding rear and side channels with high-volume clipping protection.
I've tried tracks 5.1.2 with varying results; the documentation doesn't specify how it handles them.
I agree with the idea of converting the obsolete 7.1 2D format to 5.1 too.
As you desagree with the downmix formula, you have 'your formula' to do it work right? (a script) :)
ps: i'm interested in only audio, i don't use 'videos'.
Kaisen
22nd May 2026, 17:13
Hi raquete,
So yes, the base mapping looks similar, but I’m not actually using the eact formula that was being talked about earlier. Mine’s built on the Itu layout too, but I’ve added a bunch of stuff on top of it so it doesn’t clip or shift channels around.
So it goes through aformat channel layouts=7.1 first, pins the layout so Atmos acc decoders don’t spit out wrong channel layout, then the usual SLSR too BLBR fold in at .707, and after that I run it through alimiter limit=.948 so peaks don’t blow past 0 db.
On top of that the scripts do safe peakscanning and only apply loudnorm if the track actually needs it, plus some guards for malformed 7 channel layouts. So yes, it looks like the same formula at a glance, but the whole downmix path is more than that.
Everything should work fine with audio only mkvs too.
tebasuna51
22nd May 2026, 17:50
As you desagree with the downmix formula, you have 'your formula' to do it work right? (a script) :)
Read this post. (https://forum.doom9.org/showthread.php?p=2017559#post2017559)
raquete
22nd May 2026, 18:45
OOH :goodpost:
thanks tebasuna51 :thanks: :helpful:
i have the obligation to save the page of the post you send as .pdf with pictures to read in slow motion, to understand all and learn! :)
Kaisen
30th May 2026, 21:23
Just a quick update, i’ve refreshed my github page.
All four audio downmix scripts now include latency=1, which gives the limiter a 1 sample look ahead window to catch post downmix peaks without adding any audible delay.
Also added a centralized bitrate table to all scripts, so changing audio codec bitrates is easier now.
All documentetion has been updated so everything is correct.
Kaisen
18th June 2026, 18:19
Updated AudioPeakRMSChecker.ps1
Added the following:
Integrated loudness (I) in LUFS, with EBU R128 gating threshold.
Loudness Range (LRA) in LU, with range threshold and LRA low/high.
True Peak in dBTP.
TrueHD preroll handling.
A/V sync detection.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.