A python script that extracts audio from mp4 to mp3 and saves it in the original directory
Need to install ffmpeg in advance Conversion to single threaded, time consuming
github: /cuifeiran/extract-mp3-from-mp4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2020/2/26 17:36 # @Author : CuiFeiran # @FileName : # @Software : PyCharm # @email :cui2025@ # @Blog : /qq_33273956 # @bilibili : /368768799 import os import glob from pydub import AudioSegment wenjianjia = [] path = input('Please enter the path of the parent folder to be transcoded:') for root, dirs, files in (path): (root) wjj = wenjianjia for dir in wjj: video_dir = dir extension_list = ('*.mp4', '*.flv') i = 1 (video_dir) for extension in extension_list: for video in (extension): mp3_filename = ((video))[0] + '.mp3' AudioSegment.from_file(video).export(mp3_filename, format='mp3') print('Transcoded', str(i), 'A video!') i += 1 # # for infile in ((video_dir, '*.mp4')): # (infile)
summarize
to this article on the python script to achieve mp4 audio extraction and saved in the original directory of the article is introduced to this, more related python mp4 audio extraction content, please search for my previous articles or continue to browse the following related articles I hope you will support me in the future!