Skip to content

Instantly share code, notes, and snippets.

@anytizer
Created May 21, 2026 04:51
Show Gist options
  • Select an option

  • Save anytizer/7a4f9161c5d01cfc323fd81d07fd5b44 to your computer and use it in GitHub Desktop.

Select an option

Save anytizer/7a4f9161c5d01cfc323fd81d07fd5b44 to your computer and use it in GitHub Desktop.
Embed a cover art image to a .mp3 file using ffmpeg
@echo off
setlocal enabledelayedexpansion
REM :: Create an output directory so we don't overwrite original files
mkdir "output" 2>nul
:: Loop through all .mp3 files in the current directory
for %%F in (*.mp3) do (
set "filename=%%~nF"
:: Check if a corresponding .jpg exists
if exist "!filename!.jpg" (
echo Processing: "!filename!.mp3" with "!filename!.jpg"
:: Run FFmpeg to embed the cover art
ffmpeg -y -i "%%F" -i "!filename!.jpg" -c copy -map 0:a -map 1:v -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" "output\%%F"
) else (
echo Warning: No matching .jpg found for "%%F"
)
)
echo Done! Check the 'output' folder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment