Investigation and fix for AAC encoder settings not being applied when copying music to iPod via Strawberry music player.
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.
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.
Investigation of the Strawberry source code revealed the actual architecture:
Source file → Strawberry (GStreamer) → transcoded.m4a → libgpod → iPod
Key findings:
- Strawberry uses GStreamer for transcoding, not ffmpeg directly
- libgpod does NOT transcode - it only copies already-encoded files to the iPod via
itdb_cp_track_to_ipod() - GStreamer selects an AAC encoder based on available plugins and their "rank" (priority)
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.
| 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
}| 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
Added to ~/.config/strawberry/strawberry.conf:
avenc_aac\bitrate=320000Note: 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)
The avenc_aac encoder needs a higher rank to be selected over voaacenc.
~/.profile and ~/.xsessionrc:
export GST_PLUGIN_FEATURE_RANK="avenc_aac:512"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 entryAfter logging out and back in:
- Launch Strawberry
- Transcode a file to AAC
- Check logs for:
Using 'avenc_aac' (rank 512)
| 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 |
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) |
This is arguably a bug in Strawberry - the AAC settings UI should either:
- Detect which encoder is available and save to the correct settings group
- Use a generic settings approach that maps to available encoders
Consider reporting to: https://github.com/strawberrymusicplayer/strawberry/issues
- Strawberry source: https://github.com/strawberrymusicplayer/strawberry
- GStreamer plugin ranking: https://gstreamer.freedesktop.org/documentation/gstreamer/gstpluginfeature.html
- ffmpeg AAC encoder: https://ffmpeg.org/ffmpeg-codecs.html#aac