Untitled
unknown
plain_text
a year ago
708 B
9
Indexable
import ffmpeg
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")
# Sử dụng ffmpeg để ghép video
(
ffmpeg
.input('videos_to_concat.txt', format='concat', safe=0)
.output(output_path, c='copy')
.run()
)
# 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