Assuming both videos have the same resolution and sample aspect ratio, you can use the blend filter in ffmpeg.
A couple of examples,
ffmpeg -i videoA -i videoB -filter_complex \
"[0][1]blend=all_expr=if(mod(trunc(T),2),A,B);\
[0]volume=0:enable='mod(trunc(t+1),2)'[a]; [1]volume=0:enable='mod(trunc(t),2)'[b];\
[a][b]amix" out.mp4
Straight cuts.
Output:
time, in seconds,
[0,1) -> videoB
[1,2) -> videoA
[2,3) -> videoB
...
[2N ,2N+1) -> videoB
[2N+1,2N+2) -> videoA
ffmpeg -i videoA -i videoB -filter_complex \
"[0][1]blend=all_expr='if(mod(trunc(T/2),2),min(1,2*(T-2*trunc(T/2))),max(0,1-2*(T-2*trunc(T/2))))*A+if(mod(trunc(T/2),2),max(0,1-2*(T-2*trunc(T/2))),min(1,2*(T-2*trunc(T/2))))*B';\
[0]volume='if(mod(trunc(t/2),2),min(1,2*(t-2*trunc(t/2))),max(0,1-2*(t-2*trunc(t/2))))':eval=frame[a]; [1]volume='if(mod(trunc(t/2),2),max(0,1-2*(t-2*trunc(t/2))),min(1,2*(t-2*trunc(t/2))))':eval=frame[b];\
[a][b]amix" out.mp4
Each input's video/audio for 2 seconds with a 0.5 second transition.
Output:
time, in seconds,
[0,0.5) -> videoA fades out 1 to 0 + videoB fades in from 0 to 1
[0.5,2) -> videoB
[2,2.5) -> videoB fades out 1 to 0 + videoA fades in from 0 to 1
[2.5,4) -> videoA
[4,4.5) -> videoA fades out 1 to 0 + videoB fades in from 0 to 1
[4.5,6) -> videoB
[6,6.5) -> videoB fades out 1 to 0 + videoA fades in from 0 to 1
[6.5,8) -> videoA
...
[4N ,4N+0.5) -> videoA fades out 1 to 0 + videoB fades in from 0 to 1
[4N+0.5,4N+2) -> videoB
[4N+2 ,4N+2.5) -> videoB fades out 1 to 0 + videoA fades in from 0 to 1
[4N+2.5,4N+4) -> videoA
Best Answer
Avidemux has a useful GUI interface that will let you resize and transcode.
mencoder
(part of MPlayer) can do it too, but it's also command line.I think the
ffmpeg
line you want is something like this:-s
sets the output size-i
is input file-vcodec
sets the output codec (seeffmpeg -codecs
for your full list)-o
sets the output filename (seeffmpeg -formats
for your full list)