Skip to content

Instantly share code, notes, and snippets.

@jvgomg
Created February 22, 2026 15:22
Show Gist options
  • Select an option

  • Save jvgomg/38089836f8f47aa6dcf628edac0dec08 to your computer and use it in GitHub Desktop.

Select an option

Save jvgomg/38089836f8f47aa6dcf628edac0dec08 to your computer and use it in GitHub Desktop.
Fix Strawberry AAC transcode bitrate settings when copying to an iPod

Strawberry AAC Transcoding Configuration

Investigation and fix for AAC encoder settings not being applied when copying music to iPod via Strawberry music player.

Problem Statement

When copying music to an iPod using Strawberry, the AAC transcoding bitrate settings configured in the UI were not being applied. Files were being encoded at a default bitrate regardless of the configured value.

Initial Hypothesis (Incorrect)

The initial assumption was that Strawberry uses libgpod for iPod communication, and libgpod uses ffmpeg for transcoding. This suggested building a custom ffmpeg with a different AAC library might help.

Actual Architecture

Investigation of the Strawberry source code revealed the actual architecture:

Source file → Strawberry (GStreamer) → transcoded.m4a → libgpod → iPod

Key findings:

  1. Strawberry uses GStreamer for transcoding, not ffmpeg directly
  2. libgpod does NOT transcode - it only copies already-encoded files to the iPod via itdb_cp_track_to_ipod()
  3. GStreamer selects an AAC encoder based on available plugins and their "rank" (priority)

Root Cause

The Strawberry AAC settings UI is hardcoded to save settings for the faac GStreamer element:

// src/transcoder/transcoderoptionsaac.cpp:36
constexpr char kSettingsGroup[] = "Transcoder/faac";

However, the system didn't have faac installed. GStreamer was selecting a different encoder (voaacenc), but reading settings from Transcoder/voaacenc - which was empty.

Available AAC Encoders on System

Encoder GStreamer Rank Package Notes
voaacenc 128 gstreamer1.0-plugins-bad VisualOn AAC, limited options
avenc_aac 0 → -1 gstreamer1.0-libav ffmpeg AAC, downgraded by Strawberry
faac N/A Not installed Legacy encoder, Strawberry UI assumes this
fdkaacenc N/A Not in Debian repos Best quality, requires rebuild

Strawberry's code explicitly deprioritizes ffmpeg encoders:

// src/transcoder/transcoder.cpp:122-124
if (name.startsWith("avmux"_L1) || name.startsWith("avenc"_L1)) {
    rank = -1;  // ffmpeg usually sucks
}

Solution Evaluation

Option Pros Cons
Install faac UI works as designed Old encoder, lower quality
Build FDK-AAC Best quality Not in Debian, requires rebuild
Configure voaacenc Works immediately Only bitrate configurable
Use avenc_aac Good quality, many options Requires rank override

Decision: Use avenc_aac (ffmpeg's AAC encoder) with rank override.

Rationale:

  • ffmpeg's native AAC encoder has improved significantly since 2016
  • Supports quality-relevant options (TNS, PNS, etc.)
  • Already installed via gstreamer1.0-libav
  • No compilation required

Implementation

1. Strawberry Configuration

Added to ~/.config/strawberry/strawberry.conf:

avenc_aac\bitrate=320000

Note: Other options use optimal defaults:

  • aac-tns=true (temporal noise shaping)
  • aac-pns=true (perceptual noise substitution)
  • aac-is=true (intensity stereo)
  • aac-ms=auto (mid/side stereo)

2. GStreamer Rank Override

The avenc_aac encoder needs a higher rank to be selected over voaacenc.

~/.profile and ~/.xsessionrc:

export GST_PLUGIN_FEATURE_RANK="avenc_aac:512"

3. Desktop File Override

Created ~/.local/share/applications/org.strawberrymusicplayer.strawberry.desktop to ensure the environment variable is set when launching from the application menu:

[Desktop Entry]
Version=1.0
Type=Application
Name=Strawberry
Exec=env GST_PLUGIN_FEATURE_RANK=avenc_aac:512 strawberry %U
# ... rest of desktop entry

Verification

After logging out and back in:

  1. Launch Strawberry
  2. Transcode a file to AAC
  3. Check logs for: Using 'avenc_aac' (rank 512)

Files Modified

File Change
~/.config/strawberry/strawberry.conf Added avenc_aac\bitrate=320000
~/.profile Added GST_PLUGIN_FEATURE_RANK export
~/.xsessionrc Added GST_PLUGIN_FEATURE_RANK export
~/.local/share/applications/org.strawberrymusicplayer.strawberry.desktop Created with env override

AAC Encoder Options Reference

For avenc_aac (ffmpeg):

Option Type Default Description
bitrate int 0 (auto) Target bitrate in bits/sec (e.g., 320000)
aac-coder enum twoloop Algorithm: anmr (best), twoloop (balanced), fast
aac-tns bool true Temporal noise shaping - reduces pre-echo
aac-pns bool true Perceptual noise substitution
aac-is bool true Intensity stereo coding
aac-ms bool auto Mid/side stereo coding
aac-ltp bool false Long-term prediction (compatibility issues)
aac-pred bool false AAC-Main prediction (not for AAC-LC)

Upstream Issue

This is arguably a bug in Strawberry - the AAC settings UI should either:

  1. Detect which encoder is available and save to the correct settings group
  2. Use a generic settings approach that maps to available encoders

Consider reporting to: https://github.com/strawberrymusicplayer/strawberry/issues

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment