Skip to content

FFmpeg audio conversions fail on files with embedded cover art #601

Description

@hx62150

Describe the bug

Converting audio files (e.g. MP3 → M4A/M4V) fails when the source file contains embedded album cover art. FFmpeg treats the cover art image (typically a PNG) as a video stream and attempts to encode it with libx264. The resulting H.264 stream uses the High 4:4:4 Predictive profile, which is incompatible with the M4A/M4V (ipod) container, causing the conversion to fail.

This is a very common scenario — most commercially distributed MP3 files include embedded album art.

Error log
Stream #0:1: Video: png, rgb24(pc, gbr/unknown/unknown), 1280x720 (attached pic)
Stream mapping:
Stream #0:1 -> #0:0 (png (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (mp3 (mp3float) -> aac (native))

[libx264] profile High 4:4:4 Predictive, level 6.2, 4:4:4, 8-bit
[ipod] Could not find tag for codec h264 in stream #0, codec not currently supported in container
[out#0/ipod] Could not write header (incorrect codec parameters ?): Invalid argument
Conversion failed!
Expected behavior

Audio-to-audio conversions should succeed regardless of whether the source file contains embedded cover art. Ideally, the cover art should be preserved in the output file.

Proposed fix

When the target format is audio-only (m4a, aac, flac, wav, ogg, opus, wma, etc.), the FFmpeg converter should automatically add flags to handle the embedded image stream properly. Two options, in order of preference:

Option A — Preserve cover art (preferred)
-c:v copy -disposition:v attached_pic

This copies the cover image as-is without re-encoding, preserving it in the output file.

Option B — Strip cover art (fallback)
-vn

This strips all video/image streams. The conversion succeeds but cover art is lost.

Workaround

Setting the FFMPEG_ARGS environment variable to -vn fixes this specific case but strips video from all FFmpeg conversions (including legitimate video conversions), so it is not a viable permanent solution.

Environment
ConvertX: latest (Docker)
Image: ghcr.io/c4illin/convertx:latest
Source file: MP3 with embedded PNG album art (1280x720)
Target format: M4A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions