def remediate_audio(self, path): # Create our Input() object to specify file we will be transcoding input_file = Input(path) # Create variables we will be using in the following code codec = None output_path = re.match('^(.*)\.audio\.\d\.mkv$', path).group(1) + '.final.audio.' + re.match('^.*\.audio\.(\d)\.mkv$', path).group(1) + '.mkv' output_file = Output(output_path) # Check if self.finalfiles is not none and if so create a list object. This is so we don't lose files already in the list if self.finalfiles is None: self.finalfiles = [] # Create our AudioCodec() object to define the output codec and bitrate codec = AudioCodec('ac3') codec = codec.bitrate('448k') # Instance our FFmpeg() object to begin processing remediate_audio_job = FFmpeg('/usr/bin/ffmpeg', input_file, codec, output_file) # Begin the transcoding operation iterating over the piped stdout from the command with remediate_audio_job as self._process: while not self.abort and self._process.running: for line in self._process.readlines(): if mediamanager.VERBOSE: logger.log(line, logger.DEBUG) if self._process.failed: return False elif self._process.successful: self.finalfiles.append(output_path) return True else: return False