import ffmpeg

def add_title(iv, ii):
    (
        ffmpeg
        .input(iv)
        .overlay(ffmpeg.input(ii), x=0, y=420)
        .output('out2.mp4')
        .run(cmd='./ffmpeg', overwrite_output=True)
    )
    # vid = ffmpeg.input(iv)
    # pic = ffmpeg.input(ii)
    # vid = ffmpeg.overlay(vid, pic)
    # vid = ffmpeg.output('out.mp4')
    # vid = ffmpeg.run(vid)

# add_title(iv='out.mp4', ii='image.png')

def initialize_video(iv, t):
    (
        ffmpeg
        .input(iv)
        .filter("crop", f"ih*({1080}/{1920})", f"iw*({1080}/{1920})")
        .output(segment_time='1', f='segment', reset_timestamps='1', filename=f'segments/output%03d.mp4')
        .run(cmd='./ffmpeg', overwrite_output=True)
    )

initialize_video('video.mp4', 1)
add_title('out.mp4', 'image.png')

ffmpeg.output