0

Have few doubts wrt following ffmpeg command -
ffmpeg -f concat -i input.txt -loop 1 -t 8 -i inputImg.jpg -filter_complex "[1]format=rgba,fade=alpha=1:st=0:d=8,setpts=PTS+10/TB[v1];[0][v1]overlay=x=70:y=100:enable='between(t,2,10)'" -crf 22 -threads 2 -preset ultrafast output.mp4

1- effect of loop on performance if I don't provide -t 8 and just use shortest=1 in overlay filter - will an infinite duration video will be created and only while overlaying shortest one will be selected?

2- what does setpts do? - I mentioned -t 8 - so it loops for 8 seconds. If I do `setpts=PTS+10/TB' does it increase the looped video to a duration of 18s where the fade-in effect is from 10s to 18s? what is there from 0 to 10s in the looped video?

3- how 2 videos are overlaid - are both videos are merged from 0th second?

4- if i want to have a fade effect applied on an image which will be overlaid on my video at say 100th second, then I have to create a looped video of 100s? - how will it affect the performance?

5- can frame_no of main_video[0] be used in looped_video[1]?

6- is there any performance-efficient method/alternative to get the fade-effect applied on an image, based on frame_sequence say, fade_in from frame 30-35?

0

In order,

1- effect of loop on performance if I don't provide -t 8 and just use shortest=1 in overlay filter - will an infinite duration video will be created and only while overlaying shortest one will be selected?

In theory, yes. But at present, there's a bug with shortest=1, so don't use it.

2- what does setpts do?

It alters timestamps. In your command, it adds 10 seconds to the timestamps so that the image's generated stream has its first timestamps as 10 seconds.

3- how 2 videos are overlaid - are both videos are merged from 0th second?

Frames with corresponding timestamps are overlaid i.e. Frame with PTS 10 seconds of image is overlaid on base video frame with PTS 10 seconds.

4- if i want to have a fade effect applied on an image which will be overlaid on my video at say 100th second, then I have to create a looped video of 100s? - how will it affect the performance?

No. Duration should be how long you want the video to appear. Use setpts to shift starting time.

5- can frame_no of main_video[0] be used in looped_video[1]?

The enable switch uses the frame/timestamps from the main video.

6- is there any performance-efficient method/alternative to get the fade-effect applied on an image, based on frame_sequence say, fade_in from frame 30-35?

No, same as what you're using. You can use the variables that refer to frame count for setting start s, and duration n

|improve this answer|||||
  • Ans 2 - so setpts does not affect the duration - only time-stamps are changed? Ans 5 - what I meant was frame_no of stream[0](which is read from the input.txt) be used while evaluating the fade(to calculate the setpts dynamically - I want to use enable(n, 30, 35) in overlay filter and accordingly calculate the setpts for fade)? – AM25 Apr 20 '17 at 12:27
  • Ans 6 - Used this command - ffmpeg -f concat -i input.txt -loop 1 -t 1 -i inputImg.jpg -filter_complex "[1]format=rgba,fade=alpha=1:s=0:n=9,setpts=PTS+0/TB[v1];[0][v1]overlay=x=70:y=100:enable='between(n,0,9)'" -crf 22 -threads 2 -preset ultrafast output.mp4' - but in s` and n in fade, probably refer to frames of stream[1]( the looped_video) not stream[0] (main_video read from input.txt) - the o/p of command shared here and one in the question are different. – AM25 Apr 20 '17 at 12:27
  • frame_no of stream[0](which is read from the input.txt) be used while evaluating the fade(to calculate the setpts dynamically --> not possible. setpts references the stream it is operating upon. – Gyan Apr 20 '17 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.