Package: media-fixer
Media FixerHave you ever had a film or TV show that your TV wasn't able to play its audio?
Well this program is for you.
Media Fixer is a program which converts given media to a playable format.
It's a kind of wrapper forffmpegthat works with multiple files in a concurrent & memory-buffered fashion.RequirementsPython >= 3.8 is required. (CPython and PyPy are both supported)Additionallyffmpegandmediainfoare required for this program to run. They can be installed on Ubuntu as the following way:sudoaptinstallffmpegmediainfoInstallationMedia fixer can be either installed directly via pip:pipinstallmedia-fixerOr it can be installed from the source:gitclonehttps://github.com/simsekhalit/media-fixer.git
python3-mpipinstall./media-fixerManual$ python3 -m media_fixer --help
usage: media-fixer [-h] [--audio AUDIO_STREAM] [--input-options INPUT_OPTIONS] [--max-memory MAX_MEMORY] [--output-options OUTPUT_OPTIONS] SOURCE [SOURCE ...] TARGET

A wrapper around ffmpeg to make it work in a concurrent and memory-buffered fashion.

positional arguments:
  SOURCE                source files/directories (works recursively)
  TARGET                target directory

optional arguments:
  -h, --help            show this help message and exit
  --audio AUDIO_STREAM  select index of audio stream to be used (zero-indexed). defaults to 0
  --input-options INPUT_OPTIONS
                        specify custom input file options for ffmpeg (overrides default ones)
  --max-memory MAX_MEMORY
                        specify allowed max memory usage as percent
  --output-options OUTPUT_OPTIONS
                        specify custom output file options for ffmpeg (overrides default ones)

For more information: https://github.com/simsekhalit/media-fixerMedia Fixer can be used in one of the two modes, namely Auto and Custom.Auto ModeIf no output options are given, Media Fixer works in Auto mode. Initially, an audio stream is selected with--audio.
For each given file, existing audio codec is detected and if it's in DTS format, it's converted to EAC-3.
Otherwise, it's just copied to the target file as it is.
While doing that only the selected audio stream is processed. Rest of the audio streams are stripped out.
This is useful for saving space since generally there are many audio streams in a film (English, French, Spanish, etc.),
but only one of them is needed.Custom ModeIf output options are given with--output-options, Media Fixer works in custom mode.
All the given files are converted according to given output options.ExamplesSOURCEandTARGETarguments are interpreted in the same way in both modes.Single or multiple source paths can be given. For any given source path:If it's a file, its corresponding target is written under the target path.If it's a directory, then it's traversed recursively and all the files under it are processed.
Source directory tree is generated as the same way in the target path.
Corresponding target files are written accordingly.:information_source:MediaInfois a helpful tool for identifying audio streams and their formats.
It can be downloaded fromhttps://mediaarea.net/en/MediaInfo1. There is a film and its 3rd audio (which is the audio stream with index 2) is chosen to be used:python3-mmedia_fixer--audio2'/mnt/HDD/Matrix 4.mkv''/mnt/MyUSB'Matrix 4.mkvis processed and the resulting file is written to/mnt/USB/Matrix 4.mkv2. There is a folder which contains a season of a TV show:/mnt/HDD/Brooklyn Nine-Nine Season 1
/mnt/HDD/Brooklyn Nine-Nine Season 1/S01E01.mkv
/mnt/HDD/Brooklyn Nine-Nine Season 1/S01E02.mkv
/mnt/HDD/Brooklyn Nine-Nine Season 1/S01E03.mkv
...Following command is executed:python3-mmedia_fixer'/mnt/HDD/Brooklyn Nine-Nine Season 1''/mnt/USB'All the episodes are processed and written to/mnt/USB/Brooklyn Nine-Nine Season 13. Custom ffmpeg options wanted to be used:python3-mmedia_fixer--output-options'-c:v copy -c:a aac -c:s copy -f matroska -map 0:v -map 0:a:2 -map 0:s''/mnt/HDD/Brooklyn Nine-Nine Season 1''/mnt/USB'Following ffmpeg command is run for each source file:ffmpeg-i$source-c:vcopy-c:aaac-c:scopy-fmatroska-map0:v-map0:a:2-map0:s-y-$sourceis replaced with the source file's path and output is captured from stdout,
buffered there and then written to the corresponding target path.