From 15c46d3f7d9ef45f48b95bc3fb96f1cb009b2b46 Mon Sep 17 00:00:00 2001 From: MaxwellGoblin Date: Sun, 16 Jul 2017 08:49:42 +0800 Subject: [PATCH] [ffmpeg]drop -re flag when input is not live stream --- src/you_get/common.py | 4 ++-- src/you_get/extractors/iqiyi.py | 4 +--- src/you_get/processor/ffmpeg.py | 7 +++++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/you_get/common.py b/src/you_get/common.py index 9d688e09..64c791f2 100755 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -997,7 +997,7 @@ def download_rtmp_url(url,title, ext,params={}, total_size=0, output_dir='.', re assert has_rtmpdump_installed(), "RTMPDump not installed." download_rtmpdump_stream(url, title, ext,params, output_dir) -def download_url_ffmpeg(url,title, ext,params={}, total_size=0, output_dir='.', refer=None, merge=True, faker=False): +def download_url_ffmpeg(url,title, ext,params={}, total_size=0, output_dir='.', refer=None, merge=True, faker=False, stream=True): assert url if dry_run: print('Real URL:\n%s\n' % [url]) @@ -1020,7 +1020,7 @@ def download_url_ffmpeg(url,title, ext,params={}, total_size=0, output_dir='.', title = tr(get_filename(title)) - ffmpeg_download_stream(url, title, ext, params, output_dir) + ffmpeg_download_stream(url, title, ext, params, output_dir, stream=stream) def playlist_not_supported(name): def f(*args, **kwargs): diff --git a/src/you_get/extractors/iqiyi.py b/src/you_get/extractors/iqiyi.py index 5d636ec9..ee48942d 100644 --- a/src/you_get/extractors/iqiyi.py +++ b/src/you_get/extractors/iqiyi.py @@ -206,9 +206,7 @@ class Iqiyi(VideoExtractor): # For legacy main() #Here's the change!! - download_url_ffmpeg(urls[0], self.title, 'mp4', - output_dir=kwargs['output_dir'], - merge=kwargs['merge'],) + download_url_ffmpeg(urls[0], self.title, 'mp4', output_dir=kwargs['output_dir'], merge=kwargs['merge'], stream=False) if not kwargs['caption']: print('Skipping captions.') diff --git a/src/you_get/processor/ffmpeg.py b/src/you_get/processor/ffmpeg.py index c7631b60..c7b362e1 100755 --- a/src/you_get/processor/ffmpeg.py +++ b/src/you_get/processor/ffmpeg.py @@ -207,7 +207,7 @@ def ffmpeg_concat_mp4_to_mp4(files, output='output.mp4'): os.remove(file + '.ts') return True -def ffmpeg_download_stream(files, title, ext, params={}, output_dir='.'): +def ffmpeg_download_stream(files, title, ext, params={}, output_dir='.', stream=True): """str, str->True WARNING: NOT THE SAME PARMS AS OTHER FUNCTIONS!!!!!! You can basicly download anything with this function @@ -219,7 +219,10 @@ def ffmpeg_download_stream(files, title, ext, params={}, output_dir='.'): output = output_dir + '/' + output print('Downloading streaming content with FFmpeg, press q to stop recording...') - ffmpeg_params = [FFMPEG] + ['-y', '-re', '-i'] + if stream: + ffmpeg_params = [FFMPEG] + ['-y', '-re', '-i'] + else: + ffmpeg_params = [FFMPEG] + ['-y', '-i'] ffmpeg_params.append(files) #not the same here!!!! if FFMPEG == 'avconv': #who cares?