Skip to content
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

When I use some postprocessor_args the youtube-dl gives me an AssertionError when it tries to convert #26827

Closed
mateusfmcota opened this issue Oct 6, 2020 · 2 comments
Labels

Comments

@mateusfmcota
Copy link

@mateusfmcota mateusfmcota commented Oct 6, 2020

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

Hi, I'm trying to make a code for converting videos with youtube-dl and convert it with ffmpeg after the download but I don't know the reason that when I run it it gives me an assertionError when it will convert the file.

This args is necessary because the webm [https://i.4cdn.org/wsg/1597715032203.webm] that I used for the example didn't work without making some padding if is converted to mp4 and I can cover this use case on the code I'm trying to build but using it in postprocessor_args doesn't work

This is the args I want to add:

-vf "pad=ceil(iw/2)*2:ceil(ih/2)*2"

This is mine ydl_opts:

ydl_opts = {    
                'download_archive': './db',
                'restrictfilenames': True,
                format:[{
                    'max_filesize': '50M'
                }],
                'prefer_ffmpeg': True,
                'postprocessor_args' : '-vf "pad=ceil(iw/2)*2:ceil(ih/2)*2"',
                'postprocessors': [{
                    'key': 'FFmpegVideoConvertor',
                    'preferedformat' : 'mp4'
                }],
                'verbose': True
                # 'extension' : 'mp4'
}

and this is the output I get when I try to download and convert something and gives me the assertion error:

[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.09.20
[debug] Python version 3.8.5 (CPython) - Linux-5.8.12-arch1-1-x86_64-with-glibc2.2.5
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[generic] 1597715032203: Requesting header
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://i.4cdn.org/wsg/1597715032203.webm'
[download] 1597715032203-1597715032203.webm has already been downloaded
[download] 100% of 2.56MiB
[ffmpeg] Converting video from webm to mp4, Destination: 1597715032203-1597715032203.mp4
Traceback (most recent call last):
  File "bot.py", line 32, in <module>
    ydl.download(['https://i.4cdn.org/wsg/1597715032203.webm'])
  File "/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 2018, in download
    res = self.extract_info(
  File "/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 1644, in process_video_result
    self.process_info(new_info)
  File "/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 2000, in process_info
    self.post_process(filename, info_dict)
  File "/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 2065, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/lib/python3.8/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 368, in run
    self.run_ffmpeg(path, outpath, options)
  File "/usr/lib/python3.8/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 239, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, opts)
  File "/usr/lib/python3.8/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 212, in run_ffmpeg_multiple_files
    opts += self._configuration_args()
  File "/usr/lib/python3.8/site-packages/youtube_dl/postprocessor/common.py", line 65, in _configuration_args
    return cli_configuration_args(self._downloader.params, 'postprocessor_args', default)
  File "/usr/lib/python3.8/site-packages/youtube_dl/utils.py", line 4608, in cli_configuration_args
    assert isinstance(ex_args, list)
AssertionError
@s104346
Copy link

@s104346 s104346 commented Oct 6, 2020

postprocessor_args must be a list:

                'postprocessor_args': ['-vf', 'pad=ceil(iw/2)*2:ceil(ih/2)*2'],
@mateusfmcota
Copy link
Author

@mateusfmcota mateusfmcota commented Oct 6, 2020

postprocessor_args must be a list:
'postprocessor_args': ['-vf', 'pad=ceil(iw/2)*2:ceil(ih/2)*2'],

It worked, thank you a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.