3

Basically i am doing this:

for i in *.mp4; 
do ffmpeg -i "${i}" -vf "movie=logo.png [watermark]; [in][watermark] overlay=10:10 [out]" -strict -2 -qscale 0 "${i}-watermarked.mp4"; 
done;

but this effectively does this command

do ffmpeg -i "video.mp4" -vf "movie=logo.png [watermark];\ 
 [in][watermark] overlay=10:10 [out]" -strict -2 -qscale 0 "video.mp4-watermarked.mp4"; 

the bit at the end - video.mp4-watermarked.mp4 is my issue. i want it to be video-watermarked.mp4.

how can i do this ?

1
  • I am to tired to write the answer, but you want to look at the basename command to strip the first mp4 extension.
    – Hennes
    Mar 10, 2013 at 0:06

1 Answer 1

6

If you're using bash try using ${i%%.mp4}.

For your example that would be:

for i in *.mp4; 
do ffmpeg -i "${i}" -vf "movie=logo.png [watermark]; [in][watermark] overlay=10:10 [out]" -strict -2 -qscale 0 "${i%%.mp4}-watermarked.mp4"; 
done;

There are lots of other manipulations possible the term you might want to lookup in the manual pages is Parameter Expansion.

0

You must log in to answer this question.