Untitled
unknown
plain_text
a year ago
705 B
11
Indexable
import subprocess
def concatenate_videos_ffmpeg(video_paths, output_path):
# Tạo file tạm chứa danh sách các video
with open('videos_to_concat.txt', 'w') as f:
for video_path in video_paths:
f.write(f"file '{video_path}'\n")
# Gọi ffmpeg để ghép các video
subprocess.run([
'ffmpeg', '-f', 'concat', '-safe', '0', '-i', 'videos_to_concat.txt',
'-c', 'copy', output_path
])
# Danh sách các video cần ghép
video_paths = ['video1.mp4', 'video2.mp4', 'video3.mp4']
# Đường dẫn xuất video cuối cùng
output_path = 'output.mp4'
# Ghép video
concatenate_videos_ffmpeg(video_paths, output_path)
Editor is loading...
Leave a Comment