I have a problem adding watermark to my video. I'm converting a video into 5 different resolutions using the -s option.
what I've tried:
waterMark="\"movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]\""
resolutions=$(echo -e "${resolutions} -s ${newX}x${myY} ${map} -vcodec libx264 ${options}
-vf ${waterMark} ${NEW_FILENAME}_${myY}p.mp4")
ffmpeg -i $FILENAME "${resolutions}"
here's the echo of the command: echo "ffmpeg -i $FILENAME $resolutions"
ffmpeg -i test.mp4
-s 1728x720 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_720p.mp4
-s 1152x480 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_480p.mp4
-s 864x360 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_360p.mp4
-s 576x240 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_240p.mp4
-s 344x144 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_144p.mp4
I don't know what the error is, all i'm getting is part of the code in red:
Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s Metadata: handler_name : SoundHandler
this part in red*
-s 1728x720 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_720p.mp4 -s 1152x480 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_480p.mp4 -s 864x360 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_360p.mp4 -s 576x240 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" test_240p.mp4 -s 344x144 -map 0:0 -map 0:1 -vcodec libx264 -acodec aac -strict experimental -movflags faststart -vf "movie=/watermark.png [watermark]; [in
the strange part is, if I run the code I get from echo "ffmpeg -i $FILENAME $resolutions"
from the terminal, it does work! but it's not working from bash
I also tried adding the watermark right after -i $FILENAME
ffmpeg -i $FILENAME -vf "movie=/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" $resolutions"
but in that case only the first video comes out with a watermark.
for
loop that executesffmpeg
five times.echo works
, but directly callingffnpeg
doesn't: Maybe the quotes are the problem. Have you considered writing the output of echo into a variable (tocall=$(echo "ffmpeg -i $FILENAME $resolutions")
) and then calling this variable ($($tocall)
)?[NULL @ 0x2452760] Unable to find a suitable output format for '[watermark];' [watermark];: Invalid argument