X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2F__init__.py;h=10e9c8b8c9cfe9f9ff3042384abf01fbd58d4d0b;hb=da4de959dfb4cef9b79e6b65ed7dbf6f95092904;hp=95add9eb1102d669983f6647adc6ffb9d7ad58d9;hpb=db30f02b50a565091376b316208bfdddd729b4ed;p=youtube-dl.git diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 95add9eb1..10e9c8b8c 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -22,6 +22,7 @@ __authors__ = ( 'Christian Albrecht', 'Dave Vasilevsky', 'Jaime Marquínez Ferrándiz', + 'Jeff Crouse', ) __license__ = 'Public Domain' @@ -175,7 +176,6 @@ def parseOpts(): action='store', dest='subtitleslang', metavar='LANG', help='language of the closed captions to download (optional) use IETF language tags like \'en\'') - verbosity.add_option('-q', '--quiet', action='store_true', dest='quiet', help='activates quiet mode', default=False) verbosity.add_option('-s', '--simulate', @@ -251,6 +251,8 @@ def parseOpts(): help='"best", "aac", "vorbis", "mp3", "m4a", "opus", or "wav"; best by default') postproc.add_option('--audio-quality', metavar='QUALITY', dest='audioquality', default='5', help='ffmpeg/avconv audio quality specification, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default 5)') + postproc.add_option('--recode-video', metavar='FORMAT', dest='recodevideo', default=None, + help='Encode the video to another format if necessary (currently supported: mp4|flv|ogg|webm)') postproc.add_option('-k', '--keep-video', action='store_true', dest='keepvideo', default=False, help='keeps the video file on disk after the post-processing; the video is erased by default') postproc.add_option('--no-post-overwrites', action='store_true', dest='nopostoverwrites', default=False, @@ -278,10 +280,6 @@ def parseOpts(): def _real_main(): parser, opts, args = parseOpts() - # Update version - if opts.update_self: - update_self(fd.to_screen, opts.verbose, sys.argv[0]) - # Open appropriate CookieJar if opts.cookiefile is None: jar = compat_cookiejar.CookieJar() @@ -380,6 +378,9 @@ def _real_main(): opts.audioquality = opts.audioquality.strip('k').strip('K') if not opts.audioquality.isdigit(): parser.error(u'invalid audio quality specified') + if opts.recodevideo is not None: + if opts.recodevideo not in ['mp4', 'flv', 'webm', 'ogg']: + parser.error(u'invalid video recode format specified') if sys.version_info < (3,): # In Python 2, sys.argv is a bytestring (also note http://bugs.python.org/issue2128 for Windows systems) @@ -436,6 +437,7 @@ def _real_main(): 'prefer_free_formats': opts.prefer_free_formats, 'verbose': opts.verbose, 'test': opts.test, + 'keepvideo': opts.keepvideo, }) if opts.verbose: @@ -457,7 +459,13 @@ def _real_main(): # PostProcessors if opts.extractaudio: - fd.add_post_processor(FFmpegExtractAudioPP(preferredcodec=opts.audioformat, preferredquality=opts.audioquality, keepvideo=opts.keepvideo, nopostoverwrites=opts.nopostoverwrites)) + fd.add_post_processor(FFmpegExtractAudioPP(preferredcodec=opts.audioformat, preferredquality=opts.audioquality, nopostoverwrites=opts.nopostoverwrites)) + if opts.recodevideo: + fd.add_post_processor(FFmpegVideoConvertor(preferedformat=opts.recodevideo)) + + # Update version + if opts.update_self: + update_self(fd.to_screen, opts.verbose, sys.argv[0]) # Maybe do nothing if len(all_urls) < 1: