File size: 801 Bytes
911c66e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import ffmpeg

def print_ffmpeg_args():
    concat_path = "concat.txt"
    tts_audio_path = "audio.mp3"
    
    char_stream = ffmpeg.input(concat_path, f="concat", safe=0)
    audio_stream = ffmpeg.input(tts_audio_path)
    bg_green = ffmpeg.input("color=c=0x00FF00:s=1080x1080:r=30", f="lavfi")
    
    char_stream = ffmpeg.filter(char_stream, 'scale', 1080, 1080, force_original_aspect_ratio='decrease')
    video_final = ffmpeg.overlay(bg_green, char_stream, x='(main_w-overlay_w)/2', y='(main_h-overlay_h)/2')

    out = ffmpeg.output(video_final, audio_stream, "output.mp4", vcodec="libx264", acodec="aac", audio_bitrate="192k", pix_fmt="yuv420p", r=30, shortest=None)
    
    args = ffmpeg.get_args(out)
    print(" ".join(args))

if __name__ == "__main__":
    print_ffmpeg_args()