import os import tempfile def test_ffmpeg(): img_path = "static/characters/Cuoi-tuoi.png" img_abs = os.path.abspath(img_path).replace("\\", "/") fd, concat_path = tempfile.mkstemp(suffix='.txt') with os.fdopen(fd, 'w') as f: f.write("ffconcat version 1.0\n") f.write(f"file '{img_abs}'\n") f.write("duration 2.0\n") f.write(f"file '{img_abs}'\n") print("Testing with file:", concat_path) cmd = f'ffmpeg -y -f concat -safe 0 -i "{concat_path}" -f lavfi -i color=c=0x00FF00:s=1080x1080:r=30 -filter_complex "[0:v]scale=1080:1080:force_original_aspect_ratio=decrease[char];[1:v][char]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -t 2 test_ffmpeg.mp4' os.system(cmd) print("Test finished.") if __name__ == "__main__": test_ffmpeg()