[FFmpeg-user] Embedding cover artwork in video files
Joe Dickerson
joed12385 at gmail.com
Tue Oct 11 03:34:04 EEST 2016
I'm trying to embed cover artwork into my video files (all .mp4 format). I
haven't been able to find any definitive answer on whether or not ffmpeg
can accomplish this or not. Some people said they have successfully
accomplished this and provided code that worked (from forum posts dated a
year or much later ago), but unfortunately none of them have worked for
me. As a work around I decided to use mp4art (I understand many programs
can embed, but I'm specifically looking for CLI) and it worked
beautifully. I created a .bat file to make ffmpeg copy a video/audio and
mux external .srt file, then call mp4art and embed poster.jpg. The bat
file was integrated into my right click menu via registry. Here is the bat
file:
@echo off
for /F %%i in ('dir /b *.srt') do (
goto :external
)
setlocal ENABLEDELAYEDEXPANSION
set fName=%1
set ffmpeg="F:\Apps\Media\FFMPEG\bin\ffmpeg.exe"
set mp4art="F:\Apps\Media\FFMPEG\MP4art\mp4art.exe"
for /f "tokens=* delims= " %%F in ('echo %fName%') do (
%ffmpeg% -i "%%~fF" -f srt -i "%%~fF" -c:v copy -c:a copy -c:s mov_text
-metadata:s:s:0 language=eng "%%~dpnF_new.mp4"
%mp4art% -f --add folder.jpg "%%~dpnF_new.mp4"
pause
)
exit
:external
setlocal ENABLEDELAYEDEXPANSION
set fName=%1
set ffmpeg="F:\Apps\Media\FFMPEG\bin\ffmpeg.exe"
set mp4art="F:\Apps\Media\FFMPEG\MP4art\mp4art.exe"
for /f "tokens=* delims= " %%F in ('echo %fName%') do (
%ffmpeg% -i "%%~fF" -i "%%~dpnF.eng.srt" -c:v copy -c:a copy -c:s mov_text
-metadata:s:s:0 language=eng "%%~dpnF_new.mp4"
%mp4art% -f --add folder.jpg "%%~dpnF_new.mp4"
)
exit
As stated before, this works great. I would really love to remove mp4art
and just stick with ffmpeg. Is there any way to embed cover art? I seem
to find plenty of examples for music, but the movie examples I've found
don't work.
Thanks in advance and thank you for this amazingly flexible and strong
program!!
More information about the ffmpeg-user
mailing list