[ffmpeg]drop -re flag when input is not live stream

This commit is contained in:
MaxwellGoblin 2017-07-16 08:49:42 +08:00
parent f16bf06d10
commit 15c46d3f7d
3 changed files with 8 additions and 7 deletions

View File

@ -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):

View File

@ -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.')

View File

@ -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?