Три строчки и все готово.
Код: Выделить всё
from moviepy.editor import * #подключаем пакет moviepy
audioclip = AudioFileClip("1.mp4") #видеофайл 1.mp4
audioclip.write_audiofile("out_audio.mp3") #извлеченная аудиодорожка в файл out_audio.mp3
При запуске *.py файла возможно вылетит ошибка, с пакетом Numpy:
RuntimeError: The current Numpy installation ('*****') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
Исправляем так:
Код: Выделить всё
pip uninstall numpy
pip install numpy==1.19.3