I'm trying to have apply slow motion effect to a series of videos. And further those videos will be scaled, padded and cross-faded. Following is the command I'm using to apply slow motion.
ffmpeg -i 1.mp4 -filter_complex "
[0:v]trim=0:5,setpts=PTS-STARTPTS[tv1];
[0:v]trim=5:7,setpts=PTS-STARTPTS[tv2];
[0:v]trim=start=7,setpts=PTS-STARTPTS[tv3];
[tv2]setpts=PTS*2[slow];
[tv1][slow][tv3]concat=n=3:v=1:a=0[out]" -map [out] -c:v libx264 test.mp4
I have two questions.
- Referring to
[tv2]though it is trimmed and applied the slow motion effect starting from 5th second actually it apply the effect from 4th second. What is the reason for this?
Following is the command I'm using for other processing right after concatenate in the above command.
[concat0]scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih),pad=1280:720:(1280-iw*min(1280/iw\,720/ih))/2:(720-ih*min(1280/iw\,720/ih))/2,format=pix_fmts=yuva420p,fade=t=out:st=16:d=2:alpha=1,setpts=expr=PTS-STARTPTS+10/TB[va0];
There I need to specify the setpts and I'm using the cumulative duration of the videos before the current video. Here is the complete command I'm using for it.
- How can I calculate the duration of the video after applying the slow motion effect? For instance what would be the increment of the duration of video result from the 1st command I mentioned here in seconds or even microseconds?