New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ffmpeg.py looks for ffmpeg_location #31448
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
The parameter names in the code aren't the same as the command-line options. Look at |
This well hacky code achieves the same for yt-dl as the much slicker code posted for yt-dlp, ie it shows what API parameters correspond to a given set of command-line options and so answers OP's question: import youtube_dl
from types import MethodType
from youtube_dl.utils import DateRange
def cli_to_api(*opts):
YDL = youtube_dl.YoutubeDL
class ParseYTDLResult(Exception):
def __init__(self, result):
super(ParseYTDLResult, self).__init__('result')
self.opts = result
def ytdl_init(ydl, ydl_opts):
super(YDL, ydl).__init__(ydl_opts)
raise ParseYTDLResult(ydl_opts)
YDL.__init__ = MethodType(ytdl_init, YDL)
def parsed_options(argv):
try:
youtube_dl._real_main(list(argv))
except ParseYTDLResult as result:
return result.opts
# should be set in utils
def DR__ne__(d, other):
try:
if isinstance(d, DateRange):
return d.start != other.start or d.end != other.end
except Exception:
pass
return d != other
default = parsed_options([])
diff = dict((k, v) for k, v in parsed_options(opts).items() if DR__ne__(default[k], v))
if 'postprocessors' in diff:
diff['postprocessors'] = [pp for pp in diff['postprocessors'] if pp not in default['postprocessors']]
return diff Eg:
|
dirkf
changed the title
ffmpeg.py looks for 'ffmpeg_location
ffmpeg.py looks for ffmpeg_location
Jan 12, 2023
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
Verbose log
Description
While running from command line, the location of ffmppeg can be passed using option --ffmpeg-location
However, while trying to use this in Python, using this option produces the above error, even though it's passed as below
'ffmpeg-location' : '.\Downloads\ffmpeg\bin\ffmpeg.exe',
I was trying to go through various modules where this value is being picked up, and found it in ffmpeg.py
location = self._downloader.params.get('ffmpeg_location')
now once i change the option to use this,
'ffmpeg_location' : '.\Downloads\ffmpeg\bin\ffmpeg.exe',
everything works fine. Can we either fix the code or update the documentation to use underscore, instead of hypen?
The text was updated successfully, but these errors were encountered: