Skip to content

Instantly share code, notes, and snippets.

@v0lt
Created August 29, 2022 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v0lt/60c0a2a67608f9ff3f7a97c34f54b484 to your computer and use it in GitHub Desktop.
Save v0lt/60c0a2a67608f9ff3f7a97c34f54b484 to your computer and use it in GitHub Desktop.
Convert audio from MP4 to MP3 and add first frame of video as cover art
@ECHO OFF
CHCP 65001
PUSHD %~dp0
SET ffmpegexe="C:\Utils\FFmpeg\ffmpeg.exe"
FOR %%f IN (*.mp4) DO (
%ffmpegexe% -i "%%f" -vframes 1 "%%~nf.jpg"
%ffmpegexe% -i "%%f" -i "%%~nf.jpg" -map 0:a -map 1:0 -c:v copy -codec:a libmp3lame -b:a 192k -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" "%%~nf.mp3"
DEL "%%~nf.jpg"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment