We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这个cmd命令如何运行
# yuxiang.j @ yuxiangjideMacBook-Pro in ~/Desktop/Code/未命名文件夹 2 [14:12:45] $ .\ffmpeg -r 60 -i .\frames\%4d.png -i audio.flac -c:v libx264 -shortest -af apad -crf 0 -pix_fmt yuv420p output.mp4 -y zsh: command not found: .ffmpeg # yuxiang.j @ yuxiangjideMacBook-Pro in ~/Desktop/Code/未命名文件夹 2 [14:12:48] C:127 $ .\ffmpeg -r 60 -i zsh: command not found: .ffmpeg
` macos 14.5 (23F79)
The text was updated successfully, but these errors were encountered:
我针对这个情况写了一个合成视频的代码示例
你需要安装python,opencv-python 库,moviepy 库;分别进行运行,合成视频,合成音频
pip install moviepy pip install opencv-python # 在终端中运行
import os from moviepy.editor import ImageSequenceClip, AudioFileClip # 图像文件夹路径 image_folder = 'path/to/your/image_folder/' # 输出视频文件名 output_video = 'output_video.mp4' # 音频文件路径 audio_file = 'path/to/your/audio_file.mp3' # 或 .wav 文件 # 设置限制的视频时长(单位:秒) max_duration = 10 # 限制视频时长为10秒 # 获取所有图像文件 images = [img for img in os.listdir(image_folder) if img.endswith(".jpg") or img.endswith(".png")] # 对图像进行排序 images.sort() # 创建视频剪辑 clip = ImageSequenceClip([os.path.join(image_folder, img) for img in images], fps=30) # 设置帧率为30 # 添加音频 audio = AudioFileClip(audio_file) video = clip.set_audio(audio) # 限制视频时长 if video.duration > max_duration: video = video.subclip(0, max_duration) # 输出视频文件 video.write_videofile(output_video, codec='libx264') print("视频与音频已成功合成,视频时长限制为{}秒!".format(max_duration))
#最后 在文件中记得修改;图像文件夹路径;音频文件路径
Sorry, something went wrong.
No branches or pull requests
这个cmd命令如何运行
`
macos 14.5 (23F79)
The text was updated successfully, but these errors were encountered: