Skip to content

Commit

Permalink
[ffmpeg]drop -re flag when input is not live stream
Browse files Browse the repository at this point in the history
  • Loading branch information
rosynirvana committed Jul 16, 2017
1 parent f16bf06 commit 15c46d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/you_get/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions src/you_get/extractors/iqiyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,7 @@ def download(self, **kwargs):
# 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.')
Expand Down
7 changes: 5 additions & 2 deletions src/you_get/processor/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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?
Expand Down

0 comments on commit 15c46d3

Please sign in to comment.