AC4 audio from recording file on PC? (ATSC 3.0) Convert to AC3

The new ATSC 3.0 standard is HEVC and AC4 audio.
The .mpg that Channels outputs, I have tried on my PC, Win 11, MPV, and VLC.
The video plays fine, but the AC4 audio track does not register in either player.

Those of you who have had ATSC 3.0 for a while, what is you solution to playback the recordings on PC?

Do i have, say use ffmpeg or whatever, to convert the AC4 to AC3, and re-mux?

Edit:

MKVToolnix does not even see the AC4 audio track.
Nor does Handbrake.
I try with ffmpeg, but get "Decoding requested, but no decoder found for: ac4"

So... It seems nothing supports AC4 audio. Even though it been out since 2016.
ffmpeg does not support it. There is many pages i fine online, reddit, and request pages, that say there is no progress or little interest to support it.

BUT! Channels DVR can play it fine! This it has to have a way to decode it.
Alas, it does have its own ffmpeg.exe in its program files of the server.
I copied that out, and using a .bat script, can convert the recordings to AC3 audio.
From server version: 2023.08.15.0451

It really does not like to output .mpg, give tons of red warnings and things, and the resulting file has playback issues when i play on Plex or Infuse on my Apple TV.
But setting it as .mkv, works perfect.

Here is the code, with some help from ChatGPT.

NOTES

You need to put the .mpg file in the same folder(directory) you have this .bat and the ffmpeg.exe in.
It will read in any .mpg file, and output the remuxed_name of original file.mkv with AC3 audio.

You can change the Line 3 "set "ffmpeg_path=ffmpeg.exe" to whatever path your ffmpeg.exe is, if you do not want the exe in the same folder. (I just set the exe to be hidden file)
Example "ffmpeg_path=C:\path\to\ffmpeg.exe"

You can have the output file in a separate folder or path even. Just change the end of Line 8 "remuxed_%%~ni.mkv" to "output\remuxed_%%~ni.mkv" that would output the file into a already created sub folder in the folder your are launching this from, called "output".

@echo off
REM Set the path to your FFmpeg executable
set "ffmpeg_path=ffmpeg.exe"

REM Loop through all .mpg files in the current directory
for %%i in (*.mpg) do (
    REM Use FFmpeg to remux the file
    "%ffmpeg_path%" -i "%%i" -c:v copy -c:a ac3 "remuxed_%%~ni.mkv"
    
    REM Check if FFmpeg command was successful
    if not errorlevel 1 (
		echo.
		echo.
        echo Remuxed and converted to AC3: "%%i"
		echo.
    ) else (
		echo.
		echo.
        echo Error remuxing and converting: "%%i"
		echo.
    )
)

pause

CLI output

AC4 media info

AC3 after convert

3 Likes

Hey @speedingcheetah, thank you for sharing your solution on converting the audio. It was really helpful and saved me a lot of frustration. Building upon your solution, I created a bash script specifically for Debian since I host my Channels server there. I thought I'd share it here for anyone else who might find it useful.

Notes:

  • This script assumes that the Channels server is installed in the /usr/local/ directory. If you have it installed elsewhere, make sure to update the Channels ffmpeg location in the script (/usr/local/channels-dvr/latest/ffmpeg) to match your specific setup.
  • The output file is placed in the current working directory, so be sure that the script is run from where you want the output file to be placed.
#!/usr/bin/env bash

# Check if input file argument is provided
if [ -z "$1" ]; then
  echo "Please provide the input file as an argument."
  exit 1
fi

# Extract the filename and extension from the input file
filename=$(basename "$1")
extension="${filename##*.}"
filename="${filename%.*}"

# Output file name
output_file="${filename}.mkv"

# Run ffmpeg command to convert the input file to MKV format
/usr/local/channels-dvr/latest/ffmpeg -i "$1" -c:v copy -c:a ac3 "$output_file"

echo "Conversion complete. Output file: $output_file"

Usage

  1. Save the script to a file, e.g., convert_to_mkv.

  2. Make the script executable by running chmod +x convert_to_mkv.sh.

  3. Run the script with the input file as an argument:

    ./convert_to_mkv /path/to/input_file.mpg
    

Thanks again, @speedingcheetah, for the inspiration and guidance. I hope this helps others facing the same issue. Let me know if you have any questions or suggestions for improvement!

1 Like