Spaces:
Build error
Build error
| import os | |
| import tempfile | |
| img_abs = os.path.abspath('static/characters/Cuoi-tuoi.png').replace('\\', '/') | |
| fd, 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") | |
| cmd = f'ffmpeg -y -f lavfi -i color=c=0x00FF00:s=1080x1080:r=30 -f concat -safe 0 -i "{path}" -f lavfi -i anullsrc=r=44100:cl=stereo -filter_complex "[1:v]scale=1080:1080:force_original_aspect_ratio=decrease[s0];[0:v][s0]overlay=eof_action=repeat:x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2[s1]" -map "[s1]" -map 2:a -b:a 192k -acodec aac -pix_fmt yuv420p -r 30 -shortest -vcodec libx264 -t 2 test_ffmpeg_graph.mp4' | |
| print(cmd) | |
| os.system(cmd) | |