|
|
@ -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
|
|
|
@ -171,8 +172,11 @@ class FFmpegExtractAudioPP(PostProcessor):
|
|
|
|
|
|
|
|
|
|
|
|
prefix, sep, ext = path.rpartition(u'.') # not os.path.splitext, since the latter does not work on unicode in all setups
|
|
|
|
prefix, sep, ext = path.rpartition(u'.') # not os.path.splitext, since the latter does not work on unicode in all setups
|
|
|
|
new_path = prefix + sep + extension
|
|
|
|
new_path = prefix + sep + extension
|
|
|
|
self._downloader.to_screen(u'[' + (self._exes['avconv'] and 'avconv' or 'ffmpeg') + '] Destination: ' + new_path)
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
|
|
|
|
if self._nopostoverwrites and os.path.exists(encodeFilename(new_path)):
|
|
|
|
|
|
|
|
self._downloader.to_screen(u'[youtube] Post-process file %s exists, skipping' % new_path)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self._downloader.to_screen(u'[' + (self._exes['avconv'] and 'avconv' or 'ffmpeg') + '] Destination: ' + new_path)
|
|
|
|
self.run_ffmpeg(path, new_path, acodec, more_opts)
|
|
|
|
self.run_ffmpeg(path, new_path, acodec, more_opts)
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
etype,e,tb = sys.exc_info()
|
|
|
|
etype,e,tb = sys.exc_info()
|
|
|
|