Method 1: Using FFmpeg Directly. This method involves using Python's built-in subprocess module to the appropriate FFmpeg command: In the convert_video_to_audio_ffmpeg () function, we first split the input video file name into the original file name without extension and the extension itself, so we can get the output file name by simply adding
My code uses pytube to download the audio from a video. The problem is that the downloaded audio file is either a .webm or a .mp4 file, which I'd like to convert to a .mp3 file. Is there a way to read the filetype (webm/mp4) first and then run a code that converts it to a mp3 file? I'd like to run it as a script in pycharm.
I have ffmpeg installed and use batch files to convert MP4 h.264 to MKV x.265 successfully, but I have a problem with converting FLAC files to 320 kbps MP3 w/ no metadata needed. Although many posts explain how to do this in Linux, their scripts don't solve this problem when run in the command prompt of Windows.
1 Answer. Sorted by: 93. ffmpeg doesn't look to be the appropriate tool; I'd normally use sox for audio-only files. $ sox file1.mpg -r 44100 file1-enc.mpg. If you want to try using ffmpeg anyway, I think the correct command would be. $ ffmpeg -i file1.mpg -ar 44100 file1-enc.mpg. Share. Improve this answer.
. 166 481 422 101 388 37 406 96
convert wav to mp3 ffmpeg