• AnyStream is having some DRM issues currently, Netflix is not available in HD for the time being.
    Situations like this will always happen with AnyStream: streaming providers are continuously improving their countermeasures while we try to catch up, it's an ongoing cat-and-mouse game. Please be patient and don't flood our support or forum with requests, we are working on it 24/7 to get it resolved. Thank you.

Guide Tutorial: Setting Up AAC-SBR to AAC Conversion for Enhanced Compatibility


Translator (ms_MY)
Thread Starter
Feb 27, 2011


This tutorial guides you through setting up a system to convert AAC-SBR audio to AAC for better compatibility with various software and devices. We'll use qaac for audio decoding and encoding, iTunes for necessary DLLs, and FFmpeg for integrating the audio back with the video.

Follow these steps carefully for a successful setup.

Step-by-Step Guide​

  1. Download and Set Up qaac
    • Visit the qaac releases page on GitHub
    • Download the latest release and extract it into a new folder named qaac_temp.
  2. Prepare iTunes CMD Script
    • Download the makeportable2.cmd script from here
    • Create a new folder named iTunes, and save the downloaded cmd script in this folder.
  3. Download and Process iTunes
    • Depending on your system (32-bit or 64-bit), download the appropriate iTunes version from Apple's iTunes download page.
    • Save the downloaded iTunes setup file in the iTunes folder you created earlier.
    • Run makeportable2.cmd as an administrator. This will extract the necessary DLLs for qaac into its folder.
  4. Organize qaac Files
    • In the qaac_temp folder, you'll find two subfolders: x64 and x32.
    • Copy the contents, which should be four files, from the folder that matches your OS (x64 for 64-bit, x32 for 32-bit) into a new folder named qaac.
  5. Integrate iTunes DLLs with qaac
    • Go to the iTunes folder and locate QTfiles or QTfiles64, depending on your OS and iTunes downloaded earlier.
    • Copy the entire QTfiles or QTfiles64 folder into the qaac folder.
  6. Set Up FFmpeg
    • Download FFmpegfrom its official download page
    • Extract all files from the bin folder (ffmpeg.exe, ffplay.exe, ffprobe.exe) of the downloaded archive into the qaac folder.

Explanation of Components​

  • qaac: Decodes and encodes the audio.
  • iTunes: Provides DLLs necessary for qaac.
  • FFmpeg: Integrates the new audio with the video.

Creating a Batch File for Audio Encoding​

To automate the process of encoding audio from MP4 files and integrating it back into the video, you'll need a Windows batch file.
Please create a new file called qaac_convert.bat and copy and paste the below script 1:1 into the bat file.

@echo off
SET "sourceFolder=%~dp0"
SET "qaacAudioFolder=%sourceFolder%_qaac_audio"
SET "mergedFolder=%sourceFolder%merged"

IF NOT EXIST "%qaacAudioFolder%" MKDIR "%qaacAudioFolder%"
IF NOT EXIST "%mergedFolder%" MKDIR "%mergedFolder%"

FOR %%A IN ("%sourceFolder%*.mp4") DO (
    CALL :ProcessFile "%%A"

SET "inputFile=%~1"
SET "baseName=%~n1"
SET "qaacOutputFile=%qaacAudioFolder%\%baseName%.m4a"
SET "mergedOutputFile=%mergedFolder%\%baseName%.mp4"

qaac64.exe "%inputFile%" -v 0 -q 2 -o "%qaacOutputFile%"
ffmpeg -hide_banner -i "%inputFile%" -i "%qaacOutputFile%" -map 0:v -map 1:a -c:v copy -c:a copy "%mergedOutputFile%"

Explanation of the Script​

  1. Environment Setup:
    • sourceFolder is set to the directory where the batch file is located.
    • qaacAudioFolder and mergedFolder are set to _qaac_audio and merged subdirectories within the source folder.
  2. Directory Checks:
    • The script checks if _qaac_audio and merged directories exist. If not, they are created.
  3. File Processing Loop:
    • The script iterates over all .mp4 files in the source directory.
    • For each file, it calls the ProcessFile subroutine.
  4. ProcessFile Subroutine:
    • Extracts the base name of the input file.
    • Sets the output file paths for qaac and FFmpeg.
    • Runs qaac to convert the audio, saving it in the _qaac_audio folder.
    • Runs FFmpeg to merge the new audio with the video, saving the final output in the merged folder.

Usage Instructions​

  1. Placement: Place this batch file in the folder containing your .mp4 files that have AAC-SBR audio.

  2. Tool Availability:
    • Ensure qaac and FFmpeg are accessible in the system path or in the same folder as the batch file.
    • Alternatively, you can modify the variables in the batch file to specify the paths where qaac and FFmpeg are located.
  3. Execution: Run the batch file to start the conversion and merging process.

  4. Post-Processing:
    • Please note that all the original and intermediate files will not be deleted automatically.
      They remain in their respective folders and have to be manually deleted if no longer needed.
      This is intentional.
  5. QAAC Command Quality:
    • The qaac command in this script uses the best output quality setting.
      For more information and how to adjust settings according to your needs, refer to the QAAC Wiki.

Important Note on AAC-SBR Audio in Merged Files

AAC-SBR Audio Conversion:
Please be aware that the AAC-SBR audio will no longer be in the merged audio file.
This process currently supports only one audio track in the video file, replacing the original AAC-SBR audio with the newly encoded AAC track.
As requested, I have rewritten the bat file and created a PS1 (PowerShell Script), which you can find below.
Please modify the values for the QAAC and FFMPEG paths in the script to match the locations of your executables.

This section in the script needs to be modified.

$qaacPath = "E:\qaac64.exe"
$ffmpegPath = "E:\ffmpeg.exe"

# Set the source folder to the current script directory
$sourceFolder = Get-Location

# Paths for the output directories
$ffmpegAudioFolder = Join-Path $sourceFolder "_ffmpeg_audio"
$qaacAudioFolder = Join-Path $sourceFolder "_qaac_audio"
$mergedFolder = Join-Path $sourceFolder "merged"

# Ensure output directories exist
$ffmpegAudioFolder, $qaacAudioFolder, $mergedFolder | ForEach-Object {
    if (-not (Test-Path $_)) {
        New-Item -ItemType Directory -Path $_ | Out-Null

# QAAC and FFMPEG paths
$qaacPath = "E:\qaac\qaac64.exe"
$ffmpegPath = "E:\qaac\ffmpeg.exe"

# Function to process each video file
function ProcessFile($file) {
    $baseName = [System.IO.Path]::GetFileNameWithoutExtension($file)
    $ffmpegOutputFile = Join-Path $ffmpegAudioFolder "$baseName.aac"
    $qaacOutputFile = Join-Path $qaacAudioFolder "$baseName.m4a"
    $mergedOutputFile = Join-Path $mergedFolder "$baseName.mkv"

    # FFMPEG: Extract Audio
    Write-Host "`n_________________________________________________`n`nFFMPEG: Extracting Audio for $baseName" -ForegroundColor DarkYellow
    & $ffmpegPath -hide_banner -i $file -vn -acodec copy $ffmpegOutputFile

    # QAAC: Convert Audio
    Write-Host "`n_________________________________________________`n`nQAAC: Converting Audio for $baseName" -ForegroundColor DarkYellow
    & $qaacPath $ffmpegOutputFile -v 0 -q 2 -o $qaacOutputFile

    # FFMPEG: Merge Video and New Audio
    Write-Host "`n_________________________________________________`n`nFFMPEG: Merging Video and New Audio for $baseName" -ForegroundColor DarkYellow
    & $ffmpegPath -hide_banner -i $file -i $qaacOutputFile -map 0:v -map 1:a -c:v copy -c:a copy $mergedOutputFile

    Write-Host "`n_________________________________________________`n"

# Find all video files in the source folder with specified extensions
$videoFiles = Get-ChildItem $sourceFolder -File | Where-Object { $_.Extension -match "\.(mkv|mp4|ts)$" }

# Check if any video files were found
if ($videoFiles.Count -eq 0) {
    Write-Host "No video files found in the source folder." -ForegroundColor Red
} else {
    Write-Host "$($videoFiles.Count) video files found. Processing..." -ForegroundColor Green
    $videoFiles | ForEach-Object {
        ProcessFile $_.FullName

Write-Host "All tasks completed. Press Enter to exit..."

What the script does:
  1. Sets current folder as source.
  2. Creates output directories.
  3. Defines QAAC and FFMPEG paths.
  4. Displays coloured process updates and file names with underscores for clarity.
  5. Extracts AAC-SBR audio with FFMPEG.
  6. Re-encodes the extracted AAC-SBR audio to AAC with QAAC.
  7. Merges video with new AAC audio.
  8. Processes all MKV, MP4, and TS files in the directory where the script is executed.
  9. Outputs to specified directories in the script - same as in the Batch file.
  10. Completes tasks and prompts the user to exit once completed.

Please test this script on a few files first and always create backups in case of any issues, even though it has been tested.

And this is the same as the Batch file:
Please be aware that the AAC-SBR audio will no longer be in the merged audio file.
This process currently supports only one audio track in the video file, replacing the original AAC-SBR audio with the newly encoded AAC track.
As mentioned before, you can change the quality of the audio within the scripts.

In the batch script, look for the line
 qaac64.exe "%inputFile%" -v 0 -q 2 -o "%qaacOutputFile%"

In the Powershell script, look for the line
 & $qaacPath $ffmpegOutputFile -v 0 -q 2 -o $qaacOutputFile

You only need to change the values
-v 0 -q 2

Setting examples from qaac GitHub page

Small file size:
-a 96 -q 1

Standard quality: (iTunes High Quality)
-a 128 -q 1

High quality: (iTunes Plus)
-v 256 -q 2

Maximum Quality:
-v 0 -q 2