rdio-scanner icon indicating copy to clipboard operation
rdio-scanner copied to clipboard

Add high efficiency aac support

Open ChrisDev8 opened this issue 7 months ago • 0 comments

Changed the FFmpeg arguments to enable High Efficiency AAC (HE-AAC) encoding for recorded calls to reduce storage usage while archiving calls in rdio-scanner.db.

Go to #479 for feature request

Added a configuration option to enable or disable this feature for backwards-compatibility with older versions of rdio-scanner or FFmpeg. I was able to shrink a 22,262 kb recording into a 6,554 kb recording using HE-AAC.

High Efficiency AAC v2 (HE-AAC-v2) is experimental because it requires stereo audio for the parametric encoder which could cause problems.

Below is the possible presets for audio compression including experimental HE-AAC-v2 presets. These presents are included to create a config option for controlling the amount of compression depending on your needs. Currently only the standard presets are supported.

// server/ffmpeg.go

// --- standard ---

// AAC-LC arguments (low compression) 21,651 kb
args = append(args, "-ar", "32k", "-c:a", "libfdk_aac", "-b:a", "32k", "-movflags", "frag_keyframe+empty_moov", "-f", "ipod", "-")

// AAC-LC arguments (medium compression) 16,609 kb
args = append(args, "-ar", "24k", "-c:a", "libfdk_aac", "-b:a", "24k", "-movflags", "frag_keyframe+empty_moov", "-f", "ipod", "-")

// AAC-LC arguments (high compression) 11,603 kb
args = append(args, "-ar", "16k", "-c:a", "libfdk_aac", "-b:a", "16k", "-movflags", "frag_keyframe+empty_moov", "-f", "ipod", "-")

// HE-AAC arguments (ultra compression) 9,124 kb
args = append(args, "-ar", "32k", "-c:a", "libfdk_aac", "-profile:a", "aac_he", "-b:a", "12k", "-movflags", "frag_keyframe+empty_moov", "-f", "ipod", "-")

// HE-AAC arguments (extreme compression) 6,582 kb
args = append(args, "-ar", "24k", "-c:a", "libfdk_aac", "-profile:a", "aac_he", "-b:a", "8k", "-movflags", "frag_keyframe+empty_moov", "-f", "ipod", "-")

// --- Experimental ---

// HE-AAC v2 arguments (experimental compression a) 9,193 kb
args = append(args, "-ar", "32k", "-ac", "2", "-c:a", "libfdk_aac", "-profile:a", "aac_he_v2", "-b:a", "12k", "-movflags", "frag_keyframe+empty_moov", "-f", "ipod", "-")

// HE-AAC v2 arguments (experimental compression b) 6,651 kb
args = append(args, "-ar", "24k", "-ac", "2", "-c:a", "libfdk_aac", "-profile:a", "aac_he_v2", "-b:a", "8k", "-movflags", "frag_keyframe+empty_moov", "-f", "ipod", "-")

ChrisDev8 avatar Mar 25 '25 03:03 ChrisDev8