k4yt3x / video2x

A lossless video/GIF/image upscaler achieved with waifu2x, Anime4K, SRMD and RealSR. Started in Hack the Valley II, 2018.
https://video2x.org
GNU Affero General Public License v3.0
9.92k stars 962 forks source link

TypeError: unsupported operand type(s) for /: 'NoneType' and 'int' #443

Closed andykais closed 3 years ago

andykais commented 3 years ago

Component Versions

Please at least fill in the release version and GUI or CLI version.

Symptom

running video2x on the command line results in a python error

Error Log or Screenshots

 andrew  Gash Bell  video2x -i gash-bell-01.mp4 -o gash-bell-01-video2x-upscaled.mp4 -d waifu2x_converter_cpp

    __      __  _       _                  ___   __   __
    \ \    / / (_)     | |                |__ \  \ \ / /
     \ \  / /   _    __| |   ___    ___      ) |  \ V /
      \ \/ /   | |  / _` |  / _ \  / _ \    / /    > <
       \  /    | | | (_| | |  __/ | (_) |  / /_   / . \
        \/     |_|  \__,_|  \___|  \___/  |____| /_/ \_\

                  Video2X Video Enlarger

                       Version 4.3.1

[+] INFO: Loading files into processing queue
2021-01-09 01:34:03.850792 [+] INFO: Input path(s): gash-bell-01.mp4
2021-01-09 01:34:03.855201 [+] INFO: File MIME type: video/mp4
[+] INFO: Loaded files into processing queue
2021-01-09 01:34:03.856844 [+] INFO: Input file: /media/Torrents/Gash Bell/gash-bell-01.mp4
[+] INFO: Reading file information
2021-01-09 01:34:03.856953 [+] INFO: Executing: /usr/bin/ffprobe -v quiet -print_format json -show_format -show_streams -i /media/Torrents/Gash Bell/gash-bell-01.mp4
2021-01-09 01:34:03.917333 [+] INFO: Creating cache directory /var/tmp/video2x
2021-01-09 01:34:03.918585 [+] INFO: Extracted frames are being saved to: /var/tmp/video2x/tmp_gzl_j75
2021-01-09 01:34:03.918855 [+] INFO: Upscaled frames are being saved to: /var/tmp/video2x/tmpvw4_6_fr
[+] INFO: Starting upscaling video/GIF
[+] INFO: Getting total number of frames in the file
[+] INFO: Calculating scaling parameters
Cleaning up cache directory: /var/tmp/video2x/tmp_gzl_j75
Cleaning up cache directory: /var/tmp/video2x/tmpvw4_6_fr
Cleaning up cache directory: /var/tmp/video2x
[!] ERROR: An exception has occurred
Traceback (most recent call last):
  File "/usr/bin/video2x", line 342, in <module>
    upscaler.run()
  File "/usr/share/video2x/upscaler.py", line 1023, in run
    raise e
  File "/usr/share/video2x/upscaler.py", line 737, in run
    output_width = output_height / height * width
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
[!] ERROR: The error log file can be found at: /tmp/video2x_ttilvjrr.log

I inspected the code a bit and the output_width is None here which is causing the error. I think this is just something that needs to be caught during validation (e.g. tell the user to specify either -r, -w or -h

k4yt3x commented 3 years ago

Thanks for the report. I'll investigate this.

k4yt3x commented 3 years ago

You were right. I missed a check. Just fixed it in the newest commit.