Merge remote-tracking branch 'aft90/merge-output-format'

Conflicts:
	youtube_dl/YoutubeDL.py
pull/8/head
Philipp Hagemeister 10 years ago
commit 45598f1578

@ -203,6 +203,7 @@ class YoutubeDL(object):
Progress hooks are guaranteed to be called at least once Progress hooks are guaranteed to be called at least once
(with status "finished") if the download is successful. (with status "finished") if the download is successful.
merge_output_format: Extension to use when merging formats.
The following parameters are not used by YoutubeDL itself, they are used by The following parameters are not used by YoutubeDL itself, they are used by
@ -909,6 +910,10 @@ class YoutubeDL(object):
'contain the video, try using ' 'contain the video, try using '
'"-f %s+%s"' % (format_2, format_1)) '"-f %s+%s"' % (format_2, format_1))
return return
output_ext = (
formats_info[0]['ext']
if self.params.get('merge_output_format') is None
else self.params['merge_output_format'])
selected_format = { selected_format = {
'requested_formats': formats_info, 'requested_formats': formats_info,
'format': rf, 'format': rf,
@ -921,6 +926,7 @@ class YoutubeDL(object):
'vbr': formats_info[0].get('vbr'), 'vbr': formats_info[0].get('vbr'),
'acodec': formats_info[1].get('acodec'), 'acodec': formats_info[1].get('acodec'),
'abr': formats_info[1].get('abr'), 'abr': formats_info[1].get('abr'),
'ext': output_ext,
} }
else: else:
selected_format = None selected_format = None

@ -166,6 +166,9 @@ def _real_main(argv=None):
if opts.recodevideo is not None: if opts.recodevideo is not None:
if opts.recodevideo not in ['mp4', 'flv', 'webm', 'ogg', 'mkv']: if opts.recodevideo not in ['mp4', 'flv', 'webm', 'ogg', 'mkv']:
parser.error('invalid video recode format specified') parser.error('invalid video recode format specified')
if opts.merge_output_format is not None and not '+' in opts.format: #if merge format output is used on videos that don't require merging, ignore
opts.merge_output_format = None
if opts.date is not None: if opts.date is not None:
date = DateRange.day(opts.date) date = DateRange.day(opts.date)
else: else:
@ -323,6 +326,7 @@ def _real_main(argv=None):
'encoding': opts.encoding, 'encoding': opts.encoding,
'exec_cmd': opts.exec_cmd, 'exec_cmd': opts.exec_cmd,
'extract_flat': opts.extract_flat, 'extract_flat': opts.extract_flat,
'merge_output_format': opts.merge_output_format,
'postprocessors': postprocessors, 'postprocessors': postprocessors,
} }

@ -302,6 +302,12 @@ def parseOpts(overrideArguments=None):
'--youtube-skip-dash-manifest', '--youtube-skip-dash-manifest',
action='store_false', dest='youtube_include_dash_manifest', action='store_false', dest='youtube_include_dash_manifest',
help='Do not download the DASH manifest on YouTube videos') help='Do not download the DASH manifest on YouTube videos')
video_format.add_option(
'--merge-output-format',
action='store', dest='merge_output_format', metavar='FORMAT' ,default=None,
help=(
'If a merge is required (e.g. bestvideo+bestaudio), output to given container format (e.g. mkv, mp4, ogg, webm, flv) '
'Ignored if no merge is required'))
subtitles = optparse.OptionGroup(parser, 'Subtitle Options') subtitles = optparse.OptionGroup(parser, 'Subtitle Options')
subtitles.add_option( subtitles.add_option(

Loading…
Cancel
Save