mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-22 16:44:32 +01:00
Added option to not show ffmpeg window for GUI applications
This commit is contained in:
parent
d65d89183f
commit
88df85e832
@ -52,9 +52,10 @@ class FFmpegPostProcessorError(PostProcessingError):
|
|||||||
|
|
||||||
|
|
||||||
class FFmpegPostProcessor(PostProcessor):
|
class FFmpegPostProcessor(PostProcessor):
|
||||||
def __init__(self, downloader=None):
|
def __init__(self, downloader=None, noconsole=False):
|
||||||
PostProcessor.__init__(self, downloader)
|
PostProcessor.__init__(self, downloader)
|
||||||
self._determine_executables()
|
self._determine_executables()
|
||||||
|
self._noconsole = noconsole
|
||||||
|
|
||||||
def check_version(self):
|
def check_version(self):
|
||||||
if not self.available:
|
if not self.available:
|
||||||
@ -227,7 +228,12 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
|
|
||||||
if self._downloader.params.get('verbose', False):
|
if self._downloader.params.get('verbose', False):
|
||||||
self._downloader.to_screen('[debug] ffmpeg command line: %s' % shell_quote(cmd))
|
self._downloader.to_screen('[debug] ffmpeg command line: %s' % shell_quote(cmd))
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
if self._noconsole:
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
|
||||||
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, startupinfo=startupinfo)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
stderr = stderr.decode('utf-8', 'replace')
|
stderr = stderr.decode('utf-8', 'replace')
|
||||||
@ -247,8 +253,8 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
|
|
||||||
|
|
||||||
class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
||||||
def __init__(self, downloader=None, preferredcodec=None, preferredquality=None, nopostoverwrites=False):
|
def __init__(self, downloader=None, noconsole=False, preferredcodec=None, preferredquality=None, nopostoverwrites=False):
|
||||||
FFmpegPostProcessor.__init__(self, downloader)
|
FFmpegPostProcessor.__init__(self, downloader, noconsole)
|
||||||
if preferredcodec is None:
|
if preferredcodec is None:
|
||||||
preferredcodec = 'best'
|
preferredcodec = 'best'
|
||||||
self._preferredcodec = preferredcodec
|
self._preferredcodec = preferredcodec
|
||||||
@ -350,8 +356,8 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
|||||||
|
|
||||||
|
|
||||||
class FFmpegVideoConvertorPP(FFmpegPostProcessor):
|
class FFmpegVideoConvertorPP(FFmpegPostProcessor):
|
||||||
def __init__(self, downloader=None, preferedformat=None):
|
def __init__(self, downloader=None, noconsole=False, preferedformat=None):
|
||||||
super(FFmpegVideoConvertorPP, self).__init__(downloader)
|
super(FFmpegVideoConvertorPP, self).__init__(downloader, noconsole)
|
||||||
self._preferedformat = preferedformat
|
self._preferedformat = preferedformat
|
||||||
|
|
||||||
def run(self, information):
|
def run(self, information):
|
||||||
|
Loading…
Reference in New Issue
Block a user