I am trying to create a video from two videos that will be stacked horizontally, but the resulting video is not what I expected. The same video is appearing on both sides (left and right). How can that be achieved?
The ffmpeg command I tried, which kind of worked:
ffmpeg -i left.mp4 -i right.mp4 -filter_complex "
[0:v]setpts=PTS-STARTPTS[l];
[1:v]setpts=PTS-STARTPTS,tpad=start_duration=14:start_mode=add:color=black[r];
[l][r]hstack=inputs=2[stacked]; [0:a][1:a]amix=inputs=2[a]
" -map "[stacked]" -map "[a]" -c:a aac -preset superfast result.mp4
The ffmpeg-python script that's not working:
in0 = ffmpeg.input('0.mp4')
in1 = ffmpeg.input('right.mkv')
aout = ffmpeg.filter([in0.audio, in1.audio.filter('adelay', "5000|5000")],'amix')
vout = ffmpeg.filter([inv0.video, inv1.video.filter('tpad', start_duration=5, start_mode='add', color='black')], 'hstack')
(
ffmpeg
.concat(vout, aout, v=1, a=1)
.output("out.mkv")
.run()
)
This script is not resulting in the expected output which is two videos side-by-side horizontally stacked.