1 Star 0 Fork 11

白飞飞/视频生成工具

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
多音频合一.py 994 Bytes
Copy Edit Raw Blame History
清真奶片 authored 2024-01-15 15:25 . add 多音频合一.py.
from pydub import AudioSegment
def concatenate_mp3s(file_list, output_file):
"""
拼接多个MP3文件。
:param file_list: 一个包含MP3文件路径的列表。
:param output_file: 输出文件的路径。
"""
# 创建一个空的AudioSegment对象,用于累加音频
combined = AudioSegment.empty()
# 遍历MP3文件列表,将它们逐个加载并添加到combined中
for file in file_list:
audio_file = AudioSegment.from_mp3(file)
combined += audio_file
# 将合并后的音频保存到输出文件
combined.export(output_file, format="mp3")
# 要拼接的MP3文件列表
mp3_files = ['jap/学生.mp3','jap/先生.mp3','jap/日本人.mp3']
# 输出文件的路径
output_mp3 = "path_to_output_mp3.mp3"
# 调用函数进行拼接
concatenate_mp3s(mp3_files, output_mp3)
print(f"MP3 files have been concatenated to {output_mp3}")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/byunfei/video-generation-tool.git
git@gitee.com:byunfei/video-generation-tool.git
byunfei
video-generation-tool
视频生成工具
master

Search