


One approach would be implementing custom subprocess management, e.g. However given large number of media files and all these CPU cores that are so common these days, would be kind of nice to run FFmpeg in multiple processes. Might not be a bad thing per se, if we just want to go sequentially and do not care much about visualizing progress. But it would also block on municate() for each individual FFmpeg run, and would hang there till it’s done. Now putting something like this in a loop over media files would pretty much solve the problem, right? It actually might, eventually. format ( fpath_output ))) proc = subprocess. Most of the tasks on list above are straightforward, but how about running FFmpeg from Python? A quick idea is to spin off a subprocess: 1Ĭmd = ''. And now it all is shaping up as a nice little weekend Python project… Surprisingly, apart from trivial bash scripts there did not seem to be lots of existing solutions. Given large number of files to process, would be good to run on multiple CPU coresĪs the processing might take some non-trivial time, need to show continuous / percentage progress Given a source directory, find relevant media files (including subfolders)įor some media, several processing passes might be needed Now ready to automate, the basic requirements are: And no need for detached audio stream processing, a single FFmpeg command that just works for variety of media formats. The highpass / lowpass filters values above are to optimize for audible speech, which is reasonable enough for a bunch of vacation videos. First off, while Sox noise processing produced some good results it also often ended up with undesired side effects – which In multiple cases were not much better than the original noise.įfmpeg -i -af "highpass=f=200, lowpass=f=3000" In reality a few things had to be adjusted. Relax till all is done, then check results and declare victory Fixing manually with something like Audacity is no big deal, but how should you go about lots of various media files hiding out in numerous nested directories?Ĭlearly some more powerful tools were needed, such as FFmpeg, an all-rounder covering variety of media formats or SoX, a tool specifically dedicated to sound processing.ĭetach audio stream from media into a separate file (FFmpeg)īack in the original media, replace original audio with the de-noised version (FFmpeg) Quite a few of the videos had really annoying audio noise in the background. Half an hour later I realized that while overall things look hopeful, there was a common problem. If a rainy November weekend is not a good time to finally do some basic organization of old vacation videos, when would it be then? Shows continuous progress / percentage of media files processed Uses Python multiprocessing to leverage available CPU cores 3 times for each media file in a source dir Takes a source directory, supports subfolders recursion Parallel batch media processing with FFmpeg and PythonĪ Python script for batch processing of media files
