2

I'd like some help for a project I'm working for using FFmpeg (not an expert in video editing at all!!).

BASIC IDEA I have a lot of videos in a folder and I would like to compress them + to add a short video disclaimer before each video + to add a logo as an overlay during all the video (but not during the disclaimer, which is about 12 seconds). Presently I'm using this:

ffmpeg -i intro.mpg -i video.avi -i logo.png  -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[vid1];[vid1][2:v]overlay=W-w-5:H-h-5:enable='between(t,12,300)'[vid2]" -map "[vid2]" -strict -2 -c:v libx265 -x265-params crf=28 -preset ultrafast -movflags faststart output.mp4

It works, however, I have to use the same command for a lot of videos and I don't know the duration of them (my plan is to use something as for i in *.avi; do ffmpeg -i "$i" "${i%.*}.mp4"; done).

Any way to set the filter enable='between(t,12,X)' setting X duration such as 'until the end of the video'? Many thanks!

ADVANCED

A solution to the previous issue is good enough, however, I was wondering... Could it be possible to have the logo.png overlay shifting position after a certain amount of time, until the end of the movie? For instance, 10 minutes as overlay=W-w-5:H-h-5, then 10 minutes overlay=5:H-h-5, then 10' in overlay=5:5, finally overlay=W-w-5:5 and again a new loop starting from bottom-right... Maybe starting from something like this? enable=lt(mod(t\,3)\,1) (no idea where to find friendly documentation about filters...) Thank you again!

Daniele

1 Answer 1

0

Use

overlay=W-w-5:H-h-5:enable='gt(t,12)'

For shifting overlays in counter-clockwise direction, every ten minutes i.e. 600 seconds,

overlay='5+mod(trunc(((t-12)+1200)/1200),2)*(W-w-10)':'5+mod(trunc(((t-12)+1800)/1200),2)*(H-h-10)':enable='gt(t,12)'

3
  • The solution was... "just don't specify the ending time"... shame on me! :-) Thanks a lot also for the solution to issue no.2, it works perfectly. Could you explain to me a little the code or indicate me where I could find documentation? I can't understand 5+mod and trunc command... Thank you again! Mar 11, 2019 at 15:42
  • See the functions here: ffmpeg.org/ffmpeg-utils.html#Expression-Evaluation. Basically, I alter the x and y values independently every 20 minutes (the y is 10 minutes out-of-phase).
    – Gyan
    Mar 11, 2019 at 16:56
  • @Gyan, I am using best quality png image for watermark to add it on an video but after placing watermark icon on video, watermark icon is blurred, what is reason and how can i fix this issue, please suggest. Thanks in advance.
    – Kamlesh
    Sep 12, 2020 at 7:25

This site is temporarily in read-only mode and not accepting new answers.

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