|
|
@ -62,13 +62,14 @@ class AudioConversionError(BaseException):
|
|
|
|
self.message = message
|
|
|
|
self.message = message
|
|
|
|
|
|
|
|
|
|
|
|
class FFmpegExtractAudioPP(PostProcessor):
|
|
|
|
class FFmpegExtractAudioPP(PostProcessor):
|
|
|
|
def __init__(self, downloader=None, preferredcodec=None, preferredquality=None, keepvideo=False):
|
|
|
|
def __init__(self, downloader=None, preferredcodec=None, preferredquality=None, keepvideo=False, nopostoverwrites=False):
|
|
|
|
PostProcessor.__init__(self, downloader)
|
|
|
|
PostProcessor.__init__(self, downloader)
|
|
|
|
if preferredcodec is None:
|
|
|
|
if preferredcodec is None:
|
|
|
|
preferredcodec = 'best'
|
|
|
|
preferredcodec = 'best'
|
|
|
|
self._preferredcodec = preferredcodec
|
|
|
|
self._preferredcodec = preferredcodec
|
|
|
|
self._preferredquality = preferredquality
|
|
|
|
self._preferredquality = preferredquality
|
|
|
|
self._keepvideo = keepvideo
|
|
|
|
self._keepvideo = keepvideo
|
|
|
|
|
|
|
|
self._nopostoverwrites = nopostoverwrites
|
|
|
|
self._exes = self.detect_executables()
|
|
|
|
self._exes = self.detect_executables()
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
@ -107,7 +108,11 @@ class FFmpegExtractAudioPP(PostProcessor):
|
|
|
|
acodec_opts = []
|
|
|
|
acodec_opts = []
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
acodec_opts = ['-acodec', codec]
|
|
|
|
acodec_opts = ['-acodec', codec]
|
|
|
|
cmd = ([self._exes['avconv'] or self._exes['ffmpeg'], '-y', '-i', encodeFilename(path), '-vn']
|
|
|
|
if self._nopostoverwrites:
|
|
|
|
|
|
|
|
overwrite_opts = '-n'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
overwrite_opts = '-y'
|
|
|
|
|
|
|
|
cmd = ([self._exes['avconv'] or self._exes['ffmpeg'], overwrite_opts, '-i', encodeFilename(path), '-vn']
|
|
|
|
+ acodec_opts + more_opts +
|
|
|
|
+ acodec_opts + more_opts +
|
|
|
|
['--', encodeFilename(out_path)])
|
|
|
|
['--', encodeFilename(out_path)])
|
|
|
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|