mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-12-22 22:47:55 +01:00
Rename --pp-params to --postprocessor-args and access value as super class attribute
This commit is contained in:
parent
14835de9fb
commit
1866432db7
@ -214,7 +214,7 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
--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 (default
|
--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 (default
|
||||||
5)
|
5)
|
||||||
--recode-video FORMAT Encode the video to another format if necessary (currently supported: mp4|flv|ogg|webm|mkv|xvid)
|
--recode-video FORMAT Encode the video to another format if necessary (currently supported: mp4|flv|ogg|webm|mkv|xvid)
|
||||||
--pp-params Extra parameters for video post-processor.
|
--postprocessor-args Extra parameters for video post-processor.
|
||||||
-k, --keep-video Keep the video file on disk after the post-processing; the video is erased by default
|
-k, --keep-video Keep the video file on disk after the post-processing; the video is erased by default
|
||||||
--no-post-overwrites Do not overwrite post-processed files; the post-processed files are overwritten by default
|
--no-post-overwrites Do not overwrite post-processed files; the post-processed files are overwritten by default
|
||||||
--embed-subs Embed subtitles in the video (only for mkv and mp4 videos)
|
--embed-subs Embed subtitles in the video (only for mkv and mp4 videos)
|
||||||
|
@ -261,7 +261,7 @@ class YoutubeDL(object):
|
|||||||
The following options are used by the post processors:
|
The following options are used by the post processors:
|
||||||
prefer_ffmpeg: If True, use ffmpeg instead of avconv if both are available,
|
prefer_ffmpeg: If True, use ffmpeg instead of avconv if both are available,
|
||||||
otherwise prefer avconv.
|
otherwise prefer avconv.
|
||||||
pp_params: Extra parameters for external apps, like avconv.
|
postprocessor_args: Extra parameters for external apps, like avconv.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
params = None
|
params = None
|
||||||
|
@ -171,10 +171,6 @@ 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', 'xvid']:
|
if opts.recodevideo not in ['mp4', 'flv', 'webm', 'ogg', 'mkv', 'xvid']:
|
||||||
parser.error('invalid video recode format specified')
|
parser.error('invalid video recode format specified')
|
||||||
if opts.pp_params is None:
|
|
||||||
opts.pp_params = []
|
|
||||||
else:
|
|
||||||
opts.pp_params = shlex.split(opts.pp_params)
|
|
||||||
if opts.convertsubtitles is not None:
|
if opts.convertsubtitles is not None:
|
||||||
if opts.convertsubtitles not in ['srt', 'vtt', 'ass']:
|
if opts.convertsubtitles not in ['srt', 'vtt', 'ass']:
|
||||||
parser.error('invalid subtitle format specified')
|
parser.error('invalid subtitle format specified')
|
||||||
@ -231,7 +227,7 @@ def _real_main(argv=None):
|
|||||||
postprocessors.append({
|
postprocessors.append({
|
||||||
'key': 'FFmpegVideoConvertor',
|
'key': 'FFmpegVideoConvertor',
|
||||||
'preferedformat': opts.recodevideo,
|
'preferedformat': opts.recodevideo,
|
||||||
'extra_params': opts.pp_params
|
'extra_cmd_args': opts.postprocessor_args,
|
||||||
})
|
})
|
||||||
if opts.convertsubtitles:
|
if opts.convertsubtitles:
|
||||||
postprocessors.append({
|
postprocessors.append({
|
||||||
|
@ -688,8 +688,8 @@ def parseOpts(overrideArguments=None):
|
|||||||
metavar='FORMAT', dest='recodevideo', default=None,
|
metavar='FORMAT', dest='recodevideo', default=None,
|
||||||
help='Encode the video to another format if necessary (currently supported: mp4|flv|ogg|webm|mkv|xvid)')
|
help='Encode the video to another format if necessary (currently supported: mp4|flv|ogg|webm|mkv|xvid)')
|
||||||
postproc.add_option(
|
postproc.add_option(
|
||||||
'--pp-params',
|
'--postprocessor-args',
|
||||||
dest='pp_params', default=None, metavar='ARGS',
|
dest='postprocessor_args', default=None, metavar='ARGS',
|
||||||
help='Extra parameters for video post-processor.')
|
help='Extra parameters for video post-processor.')
|
||||||
postproc.add_option(
|
postproc.add_option(
|
||||||
'-k', '--keep-video',
|
'-k', '--keep-video',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import shlex
|
||||||
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
PostProcessingError,
|
PostProcessingError,
|
||||||
@ -23,12 +24,13 @@ class PostProcessor(object):
|
|||||||
|
|
||||||
PostProcessor objects follow a "mutual registration" process similar
|
PostProcessor objects follow a "mutual registration" process similar
|
||||||
to InfoExtractor objects. And it can receive parameters from CLI trough
|
to InfoExtractor objects. And it can receive parameters from CLI trough
|
||||||
--pp-params.
|
--postprocessor-args.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_downloader = None
|
_downloader = None
|
||||||
|
|
||||||
def __init__(self, downloader=None):
|
def __init__(self, downloader=None, extra_cmd_args=None):
|
||||||
|
self._extra_cmd_args = shlex.split(extra_cmd_args or '')
|
||||||
self._downloader = downloader
|
self._downloader = downloader
|
||||||
|
|
||||||
def set_downloader(self, downloader):
|
def set_downloader(self, downloader):
|
||||||
|
@ -29,8 +29,8 @@ class FFmpegPostProcessorError(PostProcessingError):
|
|||||||
|
|
||||||
|
|
||||||
class FFmpegPostProcessor(PostProcessor):
|
class FFmpegPostProcessor(PostProcessor):
|
||||||
def __init__(self, downloader=None):
|
def __init__(self, downloader=None, extra_cmd_args=None):
|
||||||
PostProcessor.__init__(self, downloader)
|
PostProcessor.__init__(self, downloader, extra_cmd_args)
|
||||||
self._determine_executables()
|
self._determine_executables()
|
||||||
|
|
||||||
def check_version(self):
|
def check_version(self):
|
||||||
@ -287,16 +287,15 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
|||||||
|
|
||||||
|
|
||||||
class FFmpegVideoConvertorPP(FFmpegPostProcessor):
|
class FFmpegVideoConvertorPP(FFmpegPostProcessor):
|
||||||
def __init__(self, downloader=None, preferedformat=None, extra_params=[]):
|
def __init__(self, downloader=None, preferedformat=None, extra_cmd_args=None):
|
||||||
super(FFmpegVideoConvertorPP, self).__init__(downloader)
|
super(FFmpegVideoConvertorPP, self).__init__(downloader, extra_cmd_args)
|
||||||
self._preferedformat = preferedformat
|
self._preferedformat = preferedformat
|
||||||
self._extra_params = extra_params
|
|
||||||
|
|
||||||
def run(self, information):
|
def run(self, information):
|
||||||
path = information['filepath']
|
path = information['filepath']
|
||||||
prefix, sep, ext = path.rpartition('.')
|
prefix, sep, ext = path.rpartition('.')
|
||||||
ext = self._preferedformat
|
ext = self._preferedformat
|
||||||
options = self._extra_params
|
options = self._extra_cmd_args
|
||||||
if self._preferedformat == 'xvid':
|
if self._preferedformat == 'xvid':
|
||||||
ext = 'avi'
|
ext = 'avi'
|
||||||
options.extend(['-c:v', 'libxvid', '-vtag', 'XVID'])
|
options.extend(['-c:v', 'libxvid', '-vtag', 'XVID'])
|
||||||
|
Loading…
Reference in New Issue
Block a user