From e4172ac903f76dfcc5584a498f7657cde0bf977c Mon Sep 17 00:00:00 2001 From: pukkandan Date: Tue, 26 Jan 2021 23:27:32 +0530 Subject: [PATCH] Deprecate avconv/avprobe All current functionality is left untouched. But don't expect any new features to work with avconv :ci skip all --- README.md | 42 ++++++++++++----------------- youtube_dlc/YoutubeDL.py | 6 ++--- youtube_dlc/downloader/external.py | 2 +- youtube_dlc/options.py | 14 +++++----- youtube_dlc/postprocessor/ffmpeg.py | 8 +++--- 5 files changed, 32 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 886ec245f..f780df4b4 100644 --- a/README.md +++ b/README.md @@ -560,15 +560,14 @@ Then simply type this ## Post-Processing Options: -x, --extract-audio Convert video files to audio-only files - (requires ffmpeg or avconv and ffprobe or - avprobe) + (requires ffmpeg and ffprobe) --audio-format FORMAT Specify audio format: "best", "aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wav"; "best" by default; No effect without -x - --audio-quality QUALITY Specify ffmpeg/avconv audio quality, insert - a value between 0 (better) and 9 (worse) - for VBR or a specific bitrate like 128K + --audio-quality QUALITY Specify ffmpeg audio quality, insert a + value between 0 (better) and 9 (worse) for + VBR or a specific bitrate like 128K (default 5) --remux-video FORMAT Remux the video into another container if necessary (currently supported: mp4|mkv). @@ -588,15 +587,14 @@ Then simply type this FixupStretched, FixupM4a, FixupM3u8, SubtitlesConvertor and EmbedThumbnail. The supported executables are: SponSkrub, - FFmpeg, FFprobe, avconf, avprobe and - AtomicParsley. You can use this option - multiple times to give different arguments - to different postprocessors. You can also - specify "PP+EXE:ARGS" to give the arguments - to the specified executable only when being - used by the specified postprocessor. You - can use this option multiple times (Alias: - --ppa) + FFmpeg, FFprobe, and AtomicParsley. You can + use this option multiple times to give + different arguments to different + postprocessors. You can also specify + "PP+EXE:ARGS" to give the arguments to the + specified executable only when being used + by the specified postprocessor. You can use + this option multiple times (Alias: --ppa) -k, --keep-video Keep the intermediate video file on disk after post-processing --no-keep-video Delete the intermediate video file after @@ -630,15 +628,9 @@ Then simply type this emit a warning), detect_or_warn (the default; fix file if we can, warn otherwise) - --prefer-avconv Prefer avconv over ffmpeg for running the - postprocessors (Alias: --no-prefer-ffmpeg) - --prefer-ffmpeg Prefer ffmpeg over avconv for running the - postprocessors (default) - (Alias: --no-prefer-avconv) - --ffmpeg-location PATH Location of the ffmpeg/avconv binary; - either the path to the binary or its - containing directory - (Alias: --avconv-location) + --ffmpeg-location PATH Location of the ffmpeg binary; either the + path to the binary or its containing + directory --exec CMD Execute a command on the file after downloading and post-processing, similar to find's -exec syntax. Example: --exec 'adb @@ -876,7 +868,7 @@ $ youtube-dlc -o - BaW_jenozKc # FORMAT SELECTION By default, youtube-dlc tries to download the best available quality if you **don't** pass any options. -This is generally equivalent to using `-f bestvideo*+bestaudio/best`. However, if multiple audiostreams is enabled (`--audio-multistreams`), the default format changes to `-f bestvideo+bestaudio/best`. Similarly, if ffmpeg and avconv are unavailable, or if you use youtube-dlc to stream to `stdout` (`-o -`), the default becomes `-f best/bestvideo+bestaudio`. +This is generally equivalent to using `-f bestvideo*+bestaudio/best`. However, if multiple audiostreams is enabled (`--audio-multistreams`), the default format changes to `-f bestvideo+bestaudio/best`. Similarly, if ffmpeg is unavailable, or if you use youtube-dlc to stream to `stdout` (`-o -`), the default becomes `-f best/bestvideo+bestaudio`. The general syntax for format selection is `--f FORMAT` (or `--format FORMAT`) where `FORMAT` is a *selector expression*, i.e. an expression that describes format or formats you would like to download. @@ -907,7 +899,7 @@ If you want to download multiple videos and they don't have the same formats ava If you want to download several formats of the same video use a comma as a separator, e.g. `-f 22,17,18` will download all these three formats, of course if they are available. Or a more sophisticated example combined with the precedence feature: `-f 136/137/mp4/bestvideo,140/m4a/bestaudio`. -You can merge the video and audio of multiple formats into a single file using `-f ++...` (requires ffmpeg or avconv installed), for example `-f bestvideo+bestaudio` will download the best video-only format, the best audio-only format and mux them together with ffmpeg/avconv. If `--no-video-multistreams` is used, all formats with a video stream except the first one are ignored. Similarly, if `--no-audio-multistreams` is used, all formats with an audio stream except the first one are ignored. For example, `-f bestvideo+best+bestaudio` will download and merge all 3 given formats. The resulting file will have 2 video streams and 2 audio streams. But `-f bestvideo+best+bestaudio --no-video-multistreams` will download and merge only `bestvideo` and `bestaudio`. `best` is ignored since another format containing a video stream (`bestvideo`) has already been selected. The order of the formats is therefore important. `-f best+bestaudio --no-audio-multistreams` will download and merge both formats while `-f bestaudio+best --no-audio-multistreams` will ignore `best` and download only `bestaudio`. +You can merge the video and audio of multiple formats into a single file using `-f ++...` (requires ffmpeg installed), for example `-f bestvideo+bestaudio` will download the best video-only format, the best audio-only format and mux them together with ffmpeg. If `--no-video-multistreams` is used, all formats with a video stream except the first one are ignored. Similarly, if `--no-audio-multistreams` is used, all formats with an audio stream except the first one are ignored. For example, `-f bestvideo+best+bestaudio` will download and merge all 3 given formats. The resulting file will have 2 video streams and 2 audio streams. But `-f bestvideo+best+bestaudio --no-video-multistreams` will download and merge only `bestvideo` and `bestaudio`. `best` is ignored since another format containing a video stream (`bestvideo`) has already been selected. The order of the formats is therefore important. `-f best+bestaudio --no-audio-multistreams` will download and merge both formats while `-f bestaudio+best --no-audio-multistreams` will ignore `best` and download only `bestaudio`. ## Filtering Formats diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 0e93303b1..41386a778 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -347,7 +347,7 @@ class YoutubeDL(object): The following options are used by the post processors: prefer_ffmpeg: If False, use avconv instead of ffmpeg if both are available, - otherwise prefer ffmpeg. + otherwise prefer ffmpeg. (avconv support is deprecated) ffmpeg_location: Location of the ffmpeg/avconv binary; either the path to the binary or its containing directory. postprocessor_args: A dictionary of postprocessor/executable keys (in lower case) @@ -2188,7 +2188,7 @@ class YoutubeDL(object): if not merger.available: postprocessors = [] self.report_warning('You have requested multiple ' - 'formats but ffmpeg or avconv are not installed.' + 'formats but ffmpeg is not installed.' ' The formats won\'t be merged.') else: postprocessors = [merger] @@ -2272,7 +2272,7 @@ class YoutubeDL(object): if fixup_policy is None: fixup_policy = 'detect_or_warn' - INSTALL_FFMPEG_MESSAGE = 'Install ffmpeg or avconv to fix this automatically.' + INSTALL_FFMPEG_MESSAGE = 'Install ffmpeg to fix this automatically.' stretched_ratio = info_dict.get('stretched_ratio') if stretched_ratio is not None and stretched_ratio != 1: diff --git a/youtube_dlc/downloader/external.py b/youtube_dlc/downloader/external.py index f3a0d0ce4..62803a85e 100644 --- a/youtube_dlc/downloader/external.py +++ b/youtube_dlc/downloader/external.py @@ -233,7 +233,7 @@ class FFmpegFD(ExternalFD): url = info_dict['url'] ffpp = FFmpegPostProcessor(downloader=self) if not ffpp.available: - self.report_error('m3u8 download detected but ffmpeg or avconv could not be found. Please install one.') + self.report_error('m3u8 download detected but ffmpeg could not be found. Please install one.') return False ffpp.check_version() diff --git a/youtube_dlc/options.py b/youtube_dlc/options.py index 859f28e2b..89c5cf6be 100644 --- a/youtube_dlc/options.py +++ b/youtube_dlc/options.py @@ -1001,14 +1001,14 @@ def parseOpts(overrideArguments=None): postproc.add_option( '-x', '--extract-audio', action='store_true', dest='extractaudio', default=False, - help='Convert video files to audio-only files (requires ffmpeg/avconv and ffprobe/avprobe)') + help='Convert video files to audio-only files (requires ffmpeg and ffprobe)') postproc.add_option( '--audio-format', metavar='FORMAT', dest='audioformat', default='best', help='Specify audio format: "best", "aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wav"; "%default" by default; No effect without -x') postproc.add_option( '--audio-quality', metavar='QUALITY', dest='audioquality', default='5', - help='Specify ffmpeg/avconv audio quality, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default %default)') + help='Specify ffmpeg audio quality, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default %default)') postproc.add_option( '--remux-video', metavar='FORMAT', dest='remuxvideo', default=None, @@ -1030,7 +1030,7 @@ def parseOpts(overrideArguments=None): 'to give the argument to the specified postprocessor/executable. Supported postprocessors are: ' 'SponSkrub, ExtractAudio, VideoRemuxer, VideoConvertor, EmbedSubtitle, Metadata, Merger, ' 'FixupStretched, FixupM4a, FixupM3u8, SubtitlesConvertor and EmbedThumbnail. ' - 'The supported executables are: SponSkrub, FFmpeg, FFprobe, avconf, avprobe and AtomicParsley. ' + 'The supported executables are: SponSkrub, FFmpeg, FFprobe, and AtomicParsley. ' 'You can use this option multiple times to give different arguments to different postprocessors. ' 'You can also specify "PP+EXE:ARGS" to give the arguments to the specified executable ' 'only when being used by the specified postprocessor. ' @@ -1106,15 +1106,15 @@ def parseOpts(overrideArguments=None): postproc.add_option( '--prefer-avconv', '--no-prefer-ffmpeg', action='store_false', dest='prefer_ffmpeg', - help='Prefer avconv over ffmpeg for running the postprocessors (Alias: --no-prefer-ffmpeg)') + help=optparse.SUPPRESS_HELP) postproc.add_option( '--prefer-ffmpeg', '--no-prefer-avconv', - action='store_true', dest='prefer_ffmpeg', - help='Prefer ffmpeg over avconv for running the postprocessors (default) (Alias: --no-prefer-avconv)') + action='store_true', dest='prefer_ffmpeg', default=True, + help=optparse.SUPPRESS_HELP) postproc.add_option( '--ffmpeg-location', '--avconv-location', metavar='PATH', dest='ffmpeg_location', - help='Location of the ffmpeg/avconv binary; either the path to the binary or its containing directory (Alias: --avconv-location)') + help='Location of the ffmpeg binary; either the path to the binary or its containing directory') postproc.add_option( '--exec', metavar='CMD', dest='exec_cmd', diff --git a/youtube_dlc/postprocessor/ffmpeg.py b/youtube_dlc/postprocessor/ffmpeg.py index 3079d2e72..18696a932 100644 --- a/youtube_dlc/postprocessor/ffmpeg.py +++ b/youtube_dlc/postprocessor/ffmpeg.py @@ -59,7 +59,7 @@ class FFmpegPostProcessor(PostProcessor): def check_version(self): if not self.available: - raise FFmpegPostProcessorError('ffmpeg or avconv not found. Please install one.') + raise FFmpegPostProcessorError('ffmpeg not found. Please install one.') required_version = '10-0' if self.basename == 'avconv' else '1.0' if is_outdated_version( @@ -102,7 +102,7 @@ class FFmpegPostProcessor(PostProcessor): if not os.path.exists(location): self.report_warning( 'ffmpeg-location %s does not exist! ' - 'Continuing without avconv/ffmpeg.' % (location)) + 'Continuing without ffmpeg.' % (location)) self._versions = {} return elif not os.path.isdir(location): @@ -110,7 +110,7 @@ class FFmpegPostProcessor(PostProcessor): if basename not in programs: self.report_warning( 'Cannot identify executable %s, its basename should be one of %s. ' - 'Continuing without avconv/ffmpeg.' % + 'Continuing without ffmpeg.' % (location, ', '.join(programs))) self._versions = {} return None @@ -163,7 +163,7 @@ class FFmpegPostProcessor(PostProcessor): def get_audio_codec(self, path): if not self.probe_available and not self.available: - raise PostProcessingError('ffprobe/avprobe and ffmpeg/avconv not found. Please install one.') + raise PostProcessingError('ffprobe and ffmpeg not found. Please install one.') try: if self.probe_available: cmd = [