简体   繁体   English

Moviepy - 从视频中提取音频时会损坏

[英]Moviepy - audio gets corrupted when extracted from video

a simple code like this is creating a corrupted audio file for some reasons:由于某些原因,像这样的简单代码会创建损坏的音频文件:

from moviepy import *

clip = VideoFileClip("cut.mp4")
audio = clip.audio
audio.to_audiofile('temp-audio.mp3')

Expected Behavior Audio should be the same as the audio in the video预期行为音频应与视频中的音频相同

Actual Behavior audio is corrupted in the end (repeats the end segment a few times like a broken record)实际行为音频最终损坏(重复结束片段几次,就像破记录一样)

Steps to Reproduce the Problem:重现问题的步骤:

Run the code above on this video with latest moviepy version (don't make fun it's just a trial lol) and you will get this audio which is corrupted (I compressed it in a zip): here用最新的moviepy版本在这个视频上运行上面的代码(不要开玩笑,这只是一个试用版哈哈),你会得到这个损坏的音频(我把它压缩成一个zip): 这里

Specifications规格

Python Version: Python 3.9.9 Python 版本:Python 3.9.9

Moviepy Version: 1.0.3电影版本:1.0.3

may this will help you这可能会帮助你

from moviepy import *

clip = VideoFileClip("cut.mp4").subclip(0,1) 
#subclip mean video duration its from the place to start to the end
audio = clip.audio
audio.to_audiofile('temp-audio.mp3')

I hope I've been helpful我希望我有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM