k4yt3x / video2x

A machine learning-based lossless video super resolution framework. Est. Hack the Valley II, 2018.
https://video2x.org
GNU Affero General Public License v3.0
10.93k stars 1.02k forks source link

Upscaling Progress: 0% #90

Closed Mirrorman95 closed 5 years ago

Mirrorman95 commented 5 years ago

Environment Information

Module Version
video2x commit a7d41cafdfb478ee620ae33764d4bc13cee9f288 (4/30/2019)
ffmpeg ffmpeg-20190315-def18ac-win64-static
waifu2x-caffe ver 1.2.0.2 (January 2019)
waifu2x-converter-cpp DeadSix27's waifu2x-converter-cpp v5.2.4 (Mar 25 2019)

Symptom

Similar symptoms to issue #54. Every time I try to upscale any video, it encounters a fatal error and stops because it can't upscale the extracted images. Based on the logs, I think it's because the process can't even extract them successfully. Earlier versions of video2x and/or waifu2x and/or ffmpeg I used didn't use to do this and could successfully upscale videos. But since updating everything sometime after 1/17/2019, it hasn't worked for me at all. I tried switching my Python and pip versions to 3.7.3 and reinstalling tqdm, avalon_framework, colorama, GPUtil, and psutil, but none of it helped. I can upscale images just fine using waifu2x-caffe.exe with cuDNN, so I don't think that's the issue. Is there a way to fix this problem?

Error Messages

E:\Downloads\video2x-master\bin>python video2x.py -i treas.rm -o treas.mp4 --width=1600 --height=1200 --method cudnn -y upconv_7_anime_style_art_rgb -t 2
__      __  _       _                  ___   __   __
\ \    / / (_)     | |                |__ \  \ \ / /
 \ \  / /   _    __| |   ___    ___      ) |  \ V /
  \ \/ /   | |  / _` |  / _ \  / _ \    / /    > <
   \  /    | | | (_| | |  __/ | (_) |  / /_   / . \
    \/     |_|  \__,_|  \___|  \___/  |____| /_/ \_\

               Video2X Video Enlarger

                   Version 2.7.1

[!] WARNING: Specified cache directory C:\Users\Owner\AppData\Local\Temp\video2x does not exist
[?] USER: Create directory? [Y/n]: y
[+] INFO: C:\Users\Owner\AppData\Local\Temp\video2x created
[+] INFO: Upscaling single video file: treas.rm
2019-05-01 02:37:09.331010 [+] INFO: Extracted frames are being saved to: C:\Users\Owner\AppData\Local\Temp\video2x\tmpj80k67w9
2019-05-01 02:37:09.333001 [+] INFO: Upscaled frames are being saved to: C:\Users\Owner\AppData\Local\Temp\video2x\tmpbno1kge2
2019-05-01 02:37:09.335001 [+] INFO: Executing: ['C:\\Users\\Owner\\AppData\\Local\\video2x\\ffmpeg-latest-win64-static\\bin\\ffmpeg.exe', '-i', 'E:\\Downloads\\video2x-master\\bin\\treas.rm', 'C:\\Users\\Owner\\AppData\\Local\\Temp\\video2x\\tmpj80k67w9\\extracted_%0d.png', '-hwaccel', 'auto', '-y']
ffmpeg version N-93710-gac551c54b1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 52.100 / 58. 52.100
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 50.100 /  7. 50.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Trailing options were found on the commandline.
[rm @ 0000020f0aa39f40] Invalid stream index 2 for index at pos 3987316
Input #0, rm, from 'E:\Downloads\video2x-master\bin\treas.rm':
  Metadata:
    Target Audiences: 256K DSL/Cable Modem (225 Kbps);
    Audio Format    : Voice with Background Music
    Video Quality   : Sharpest Image Video
    Creation Date   : 12/12/2000 21:03:52
    Modification Date: 12/12/2000 21:03:52
    Generated By    : RealProducer 8.0.0.45 Windows
    Keywords        :
    Abstract        :
    Content Rating  : (PICS-1.1 "http://www.classify.org/safesurf" labels comment "RealProducer 8.0.0.45 Windows" ratings (SS~~000 1))
    File ID         : 75111e8e-805e-9fa4-f1cb-ec790b4a6489
    title           : TREAS
  Duration: 00:02:20.43, start: 0.000000, bitrate: 227 kb/s
    Stream #0:0: Audio: cook (cook / 0x6B6F6F63), 22050 Hz, mono, fltp, 32 kb/s
    Stream #0:1: Video: rv30 (RV30 / 0x30335652), yuv420p, 160x120, 192 kb/s, 14.87 fps, 14.87 tbr, 1k tbn, 1k tbc
Stream mapping:
  Stream #0:1 -> #0:0 (rv30 (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'C:\Users\Owner\AppData\Local\Temp\video2x\tmpj80k67w9\extracted_%0d.png':
  Metadata:
    Target Audiences: 256K DSL/Cable Modem (225 Kbps);
    Audio Format    : Voice with Background Music
    Video Quality   : Sharpest Image Video
    Creation Date   : 12/12/2000 21:03:52
    Modification Date: 12/12/2000 21:03:52
    Generated By    : RealProducer 8.0.0.45 Windows
    Keywords        :
    Abstract        :
    Content Rating  : (PICS-1.1 "http://www.classify.org/safesurf" labels comment "RealProducer 8.0.0.45 Windows" ratings (SS~~000 1))
    File ID         : 75111e8e-805e-9fa4-f1cb-ec790b4a6489
    title           : TREAS
    encoder         : Lavf58.27.103
    Stream #0:0: Video: png, rgb24, 160x120, q=2-31, 200 kb/s, 14.87 fps, 14.87 tbn, 14.87 tbc
    Metadata:
      encoder         : Lavc58.52.100 png
frame= 2080 fps=756 q=-0.0 Lsize=N/A time=00:02:19.83 bitrate=N/A dup=3 drop=0 speed=50.8x
video:94337kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[+] INFO: Reading video information
2019-05-01 02:37:12.194862 [+] INFO: Executing: C:\Users\Owner\AppData\Local\video2x\ffmpeg-latest-win64-static\bin\ffprobe.exe -v quiet -print_format json -show_format -show_streams -i E:\Downloads\video2x-master\bin\treas.rm
[+] INFO: Framerate: 14.874267578125
[+] INFO: Starting to upscale extracted images
2019-05-01 02:37:14.124863 [+] INFO: Starting upscaled image cleaner
2019-05-01 02:37:14.126865 [+] INFO: [upscaler] Thread 0 started
2019-05-01 02:37:14.127864 [+] INFO: Executing: ['C:\\Users\\Owner\\AppData\\Local\\video2x\\waifu2x-caffe\\waifu2x-caffe-cui.exe', '--output_extention', 'png', '--mode', 'noise_scale', '--scale_width', '1600', '--scale_height', '1200', '--noise_level', '3', '--process', 'cudnn', '--crop_size', '128', '--output_quality', '-1', '--output_depth', '8', '--batch_size', '1', '--gpu', '0', '--tta', '0', '--input_path', 'C:\\Users\\Owner\\AppData\\Local\\Temp\\video2x\\tmpj80k67w9\\1', '--output_path', 'C:\\Users\\Owner\\AppData\\Local\\Temp\\video2x\\tmpbno1kge2', '--model_dir', 'upconv_7_anime_style_art_rgb']2019-05-01 02:37:14.127864 [+] INFO: [upscaler] Thread 1 started

2019-05-01 02:37:14.130863 [+] INFO: Executing: ['C:\\Users\\Owner\\AppData\\Local\\video2x\\waifu2x-caffe\\waifu2x-caffe-cui.exe', '--output_extention', 'png', '--mode', 'noise_scale', '--scale_width', '1600', '--scale_height', '1200', '--noise_level', '3', '--process', 'cudnn', '--crop_size', '128', '--output_quality', '-1', '--output_depth', '8', '--batch_size', '1', '--gpu', '0', '--tta', '0', '--input_path', 'C:\\Users\\Owner\\AppData\\Local\\Temp\\video2x\\tmpj80k67w9\\1', '--output_path', 'C:\\Users\\Owner\\AppData\\Local\\Temp\\video2x\\tmpbno1kge2', '--model_dir', 'upconv_7_anime_style_art_rgb']
Upscaling Progress:   0%|                                                                     | 0/2080 [00:01<?, ?it/s] エラー: モデルファイルが開けませんでした
エラー: モデルファイルが開けませんでした
2019-05-01 02:37:15.482861 [+] INFO: Killing upscaled image cleaner
Upscaling Progress:   0%|                                                                     | 0/2080 [00:02<?, ?it/s][!] ERROR: An exception has occurred
Traceback (most recent call last):
  File "video2x.py", line 318, in <module>
    upscaler.run()
  File "E:\Downloads\video2x-master\bin\upscaler.py", line 295, in run
    self._upscale_frames(w2)
  File "E:\Downloads\video2x-master\bin\upscaler.py", line 234, in _upscale_frames
    raise(self.upscaler_exceptions[0])
  File "E:\Downloads\video2x-master\bin\waifu2x_caffe.py", line 83, in upscale
    completed_command = subprocess.run(execute, check=True)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['C:\\Users\\Owner\\AppData\\Local\\video2x\\waifu2x-caffe\\waifu2x-caffe-cui.exe', '--output_extention', 'png', '--mode', 'noise_scale', '--scale_width', '1600', '--scale_height', '1200', '--noise_level', '3', '--process', 'cudnn', '--crop_size', '128', '--output_quality', '-1', '--output_depth', '8', '--batch_size', '1', '--gpu', '0', '--tta', '0', '--input_path', 'C:\\Users\\Owner\\AppData\\Local\\Temp\\video2x\\tmpj80k67w9\\1', '--output_path', 'C:\\Users\\Owner\\AppData\\Local\\Temp\\video2x\\tmpbno1kge2', '--model_dir', 'upconv_7_anime_style_art_rgb']' returned non-zero exit status 1.
k4yt3x commented 5 years ago

It looks like some kind of a permission error? I'm not quite sure what the problem is.

Also, you seem to have downloaded waifu2x yourself. I believe setting the program up with the given setup script gives the correct file attributes and permissions, thus no errors.

Mirrorman95 commented 5 years ago

Alright, I ran video2x_setup.py and pip install -r requirements.txt, but even after that I get a similar error. I updated my Error Messages section with the output of my post-setup video2x attempt.

k4yt3x commented 5 years ago

@Mirrorman95 does running the command as administrator do you any good? I'm not quite sure what the problem is right now. I'm more of a Linux person than Windows. I'm therefore not that familiar with how Windows permissions work.

Mirrorman95 commented 5 years ago

I've already tried running the command line program as administrator, but that doesn't fix it.

k4yt3x commented 5 years ago

If you change the code on line 83 of waifu2x_converter.py from

            completed_command = subprocess.run(execute, check=True)

to

            completed_command = subprocess.run(execute, shell=True, check=True)

Does this do anything?

Mirrorman95 commented 5 years ago

I checked the current version of github.com/k4yt3x/video2x/blob/master/bin/waifu2x_converter.py, but "completed_command" doesn't show up anywhere there. The closest thing to what you described is line 96: return subprocess.run(execute, check=True).returncode Did you want me to modify that line instead?

Evedestroyer commented 5 years ago

I checked the current version of github.com/k4yt3x/video2x/blob/master/bin/waifu2x_converter.py, but "completed_command" doesn't show up anywhere there. The closest thing to what you described is line 96: return subprocess.run(execute, check=True).returncode Did you want me to modify that line instead?

Hey, i had the exact same issue, utill I install CUDA and CUDNN. If you have nvidia graphics card, install both of them and add "-m cudnn" after ur command line, and it should work fine.

k4yt3x commented 5 years ago

@Mirrorman95 Yes sorry I was looking at the wrong file lol

k4yt3x commented 5 years ago

@Evedestroyer if you use -m gpu or -m cudnn, CUDA or CUDNN is required. It's stated in the prerequisites section.

Mirrorman95 commented 5 years ago

I've had CUDA v10.0 of the NVIDIA GPU Computing Toolkit installed since January. Is that sufficient? Also, I tried editing that line, and also passing gpu and cpu through the command line instead, but it had no effect.

k4yt3x commented 5 years ago

You need CUDA driver 419.35+ for waifu2x-converter-cpp won't be a bad idea to try updating the driver

Mirrorman95 commented 5 years ago

I already have GeForce Game Ready Driver 430.39.

Evedestroyer commented 5 years ago

@Mirrorman95 did u try install cuDNN and go through cuDNN method? https://developer.nvidia.com/cudnn It is a deep learning library over CUDA, not to be confused with CUDA itself. do u have error log handy?

Mirrorman95 commented 5 years ago

The dev install for cuDNN is just a dll, which I did download and put into my original waifu2x-caffe installation, but it didn't work when I ran video2x from that installation, so that isn't the problem. I still suspect that the problem is that the ffmpeg or video2x scripts aren't successfully extracting the images from the video.

Evedestroyer commented 5 years ago

The dev install for cuDNN is just a dll, which I did download and put into my original waifu2x-caffe installation, but it didn't work when I ran video2x from that installation, so that isn't the problem. I still suspect that the problem is that the ffmpeg or video2x scripts aren't successfully extracting the images from the video.

the cuDNN is a CUDA library, so unzip it to your CUDA install path. Then, go to waifu2x-caffe GUI and click "Check cuDNN" button. If it says "cuDNN can be used", then you are good to go.

btw, the error message you gave shows the 2080 frames were extracted, so ffmpeg part is not an issue.

subprocess.CalledProcessError: Command '['C:\Users\Owner\AppData\Local\video2x\waifu2x-caffe\waifu2x-caffe-cui.exe', '--output_extention', 'png', '--mode', 'noise_scale', '--scale_width', '1600', '--scale_height', '1200', '--noise_level', '3', '--process', 'cpu', '--crop_size', '128', '--output_quality', '-1', '--output_depth', '8', '--batch_size', '1', '--gpu', '0', '--tta', '0', '--input_path', 'C:\Users\Owner\AppData\Local\Temp\video2x\tmpjtmj8i91\1', '--output_path', 'C:\Users\Owner\AppData\Local\Temp\video2x\tmpt8uc9tlx', '--model_dir', 'upconv_7_anime_style_art_rgb']' returned non-zero exit status 1.

Try these:

  1. reduce thread to 1 by using "-t 1", more thread is more likely to crash
  2. dont use "-y upconv_7_anime_style_art_rgb", it wont pass the full install path of the model. you should add these settings to video2x.json, for example: "model_dir": "C:\\Users\\Owner\\AppData\\Local\\video2x\\waifu2x-caffe\\models\\upconv_7_anime_style_art_rgb",
Mirrorman95 commented 5 years ago

After I unzipped it to my CUDA 10.1 installation directory, it said it couldn't be used. But when I put the dll in the waifu2x-caffe folder the setup made me, it said it could be used. But it still gave me a similar error when I ran video2x:

Upscaling Progress: 0%| | 0/2080 [00:00<?, ?it/s] エラー: モデルファイルが開けませんでした エラー: モデルファイルが開けませんでした Upscaling Progress: 0%| | 0/2080 [00:01<?, ?it/s]2019-05-08 10:03:46.513998 [+] INFO: Killing upscaled image cleaner Upscaling Progress: 0%| | 0/2080 [00:02<?, ?it/s][!] ERROR: An exception has occurred Traceback (most recent call last): File "video2x.py", line 318, in upscaler.run() File "E:\Downloads\video2x-master\bin\upscaler.py", line 295, in run self._upscale_frames(w2) File "E:\Downloads\video2x-master\bin\upscaler.py", line 234, in _upscale_frames raise(self.upscaler_exceptions[0]) File "E:\Downloads\video2x-master\bin\waifu2x_caffe.py", line 83, in upscale completed_command = subprocess.run(execute, check=True) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\subprocess.py", line 487, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['C:\Users\Owner\AppData\Local\video2x\waifu2x-caffe\waifu2x-caffe-cui.exe', '--output_extention', 'png', '--mode', 'noise_scale', '--scale_width', '1600', '--scale_height', '1200', '--noise_level', '3', '--process', 'cpu', '--crop_size', '128', '--output_quality', '-1', '--output_depth', '8', '--batch_size', '1', '--gpu', '0', '--tta', '0', '--input_path', 'C:\Users\Owner\AppData\Local\Temp\video2x\tmpjtmj8i91\1', '--output_path', 'C:\Users\Owner\AppData\Local\Temp\video2x\tmpt8uc9tlx', '--model_dir', 'upconv_7_anime_style_art_rgb']' returned non-zero exit status 1.

k4yt3x commented 5 years ago

エラー: モデルファイルが開けませんでした

Which means "Error: Could not open model file".

You've also didn't specify the model file directory correctly.

Mirrorman95 commented 5 years ago

Try these:

  1. reduce thread to 1 by using "-t 1", more thread is more likely to crash
  2. dont use "-y upconv_7_anime_style_art_rgb", it wont pass the full install path of the model. you should add these settings to video2x.json, for example: "model_dir": "C:\Users\Owner\AppData\Local\video2x\waifu2x-caffe\models\upconv_7_anime_style_art_rgb",

Hey, I think that fixed it! I got rid of the -y statement and changed my json's "model_dir": "models/cunet" to "model_dir": "C:\Users\Owner\AppData\Local\video2x\waifu2x-caffe\models\upconv_7_photo", and now it's upscaling again! Thank you.

k4yt3x commented 5 years ago

Well I'm closing it then if it's fixed.