I have 2 T
-seconds-long videos that are made from PNG
images using the following commands:
ffmpeg -i workspace/1.png -vcodec libx264 -t T ./1.mp4
ffmpeg -i workspace/2.png -vcodec libx264 -t T ./2.mp4
Using those videos, I'm trying to create a transition between those 2 videos that lasts for T
seconds, where we start with the first video and fade into the second one. Here's a simple ASCII visualization of the transition I have in mind:
Alpha \ Time 0.........T
1.mp4 100.........0
2.mp4 0.......100
So, both the videos, as well as the fade effect should start immediately, and end with the video itself. (i.e., offset is 0
and duration is T
)
But when I try to produce such a video, the resulting MP4
just consists of the video of 1.mp4
, with no fade effect whatsoever. Here's the command I used for producing the transition video:
ffmpeg -i 1.mp4 -i 2.mp4 -y -filter_complex "xfade=transition=fade:offset=0:duration=T" -t T ./1-2.mp4
I thought the offset and duration parameters in that filter_complex
option were enough to get the transition going.
I've looked at similar StackOverflow questions, but in all of those the fade effect was between the videos that run sequentially, not in parallel. Is that what's happening here? How do I make both videos run in parallel from the start, while the fade is being applied to them?