Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question
    
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 '13 at 0:06
up vote 6 down vote accepted

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.

share|improve this answer
    
thanks looks like that will do it – slycat Mar 10 '13 at 2:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .