Город МОСКОВСКИЙ
00:09:04

FFMPEG Python - Convert Audio Files to MP3 SUPER FAST ! ?

Аватар
PythonЛидер
Просмотры:
31
Дата загрузки:
02.12.2023 19:59
Длительность:
00:09:04
Категория:
Технологии и интернет

Описание

FFMPEG Python - Convert Audio Files to MP3 SUPER FAST ! ?
How to convert thousands of flac, wav, wma, aac, m4a, aiff, webm, ogg, opus or raw audio files to mp3 ?super fast? using ffmpeg and Python.

In this video we start off by simulating a bash for loop and converting the flac test files sequentially using ffmpeg to demonstrate that only one CPU core is used to transcode the group of flac files to mp3 files using this method. Leaving all of the other CPU cores essentially idling.

We then modify the python script with one simple change to use all of the available CPU cores to convert our flac files to mp3 files and this gives us a massive speed boost, we cut down the transcode time significantly.
Finally we increase our transcode speed even more by using variable bit rate (VBR) mp3 files instead of creating constant bit rate (CBR) mp3 files.

This allowed use to increase our transcode speed to over 725%? ( yes you read that right, Seven hundred and twenty five percent speed increase ) faster than our bash for loop method.

We could probably get this speed increase go a little higher if we were to use asycio instead of a thread pool as this would eliminate the thread creation overhead and thread banging wouldn't occur. I may test this in the future but I think over 725%? speed increase is pretty good for a 20 minutes rough python script.

Would be interesting to see how fast this would be on a 64 core AMD Threadripper.?

OS: Ubuntu 19.04
FFmpeg version: 7:4.1.3-0ubuntu1

Github: https://github.com/Linuxleech/flac-to-mp3
Subscribe: https://www.youtube.com/user/linuxleech?sub_confirmation=1

Blog: http://www.linuxleech.com
Twitter: http://www.twitter.com/linuxleech
Facebook: http://www.facebook.com/linuxleech

Рекомендуемые видео