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

ffmpeg subprocess being very slow or stucking the main process? #86

Open
GalGreenfield opened this issue Feb 4, 2022 · 3 comments
Open

Comments

@GalGreenfield
Copy link

GalGreenfield commented Feb 4, 2022

I'm using video2x to upscale a video file that weighs around 4GB, in 1080p resolution to cinematic 4K, using Anime4KCPP.

Hardware-wise I'm using:

  • CPU: Ryzen 5950X
  • GPU: RTX 3090, overclocked a bit
  • Stoage: a very fast 2TB SSD
  • RAM: fast 64GB RA

So I doubt that I have any hardware bottlenecks here with Anime4KCPP.
My FPS creation rate is about 2 and a bit.

According to the Video2X executable (video2x.exe), that shows logs (that are printed to a terminal session), the parts of separating the source into frames using ffmpeg + creating the new frames, if I'm not mistaken, took my machine about an 30 minutes. The full logs are attached at the bottom of this issue.

It's been running for about 4 hours now since that stage, and is currently stuck/doing this, according to the logs:

[+] INFO: Converting extracted frames into video
2022-02-04 17:23:56.475034 [+] INFO: Executing: C:\Windows\system32\dependencies\ffmpeg\bin\ffmpeg -r 23.976023976023978 -hwaccel auto -y -f image2 -i C:\Users\GalGr\AppData\Local\Temp\video2x\tmpv42p9c68\extracted_%d.png -vcodec libx264 -pix_fmt yuv420p -crf 17 -vf pad=ceil(iw/2)*2:ceil(ih/2)*2 -tune animation C:\Users\GalGr\AppData\Local\Temp\video2x\tmpv42p9c68\intermediate.mkv
2022-02-04 17:23:56.675062 [+] INFO: Main process waiting for subprocesses to exit

I want to understand so I can figure out a way to make it finish (or just make it finish):

  1. What is this subprocess that it's doing?
  2. Is it very computationally complex so it's taking my machine a long time to do it?
  3. Or is it stuck? And if so, why?

*I don't have much else running on the machine and my GPU is pretty much idling, and the CPU has around 46% utilization by ffmpeg.

I assume this is an ffmpeg issue but I'm asking here in case you're willing to help and maybe also can help or know why what's going on, or maybe can refer me to the right support.

Here are the full logs from video2x.exe:

[+] INFO: Loading files into processing queue
2022-02-04 16:50:01.122942 [+] INFO: Input path(s): C:\Users\GalGr\OneDrive\Desktop\Attack on Titan The Final Season 1080p Dual Audio BD Remux FLAC-TTGA\S04E01-The Other Side of the Sea.mkv
2022-02-04 16:50:01.123443 [+] INFO: File MIME type: video/x-matroska
[+] INFO: Loaded files into processing queue
2022-02-04 16:50:01.125443 [+] INFO: Input file: C:\Users\GalGr\OneDrive\Desktop\Attack on Titan The Final Season 1080p Dual Audio BD Remux FLAC-TTGA\S04E01-The Other Side of the Sea.mkv
[+] INFO: Reading file information
2022-02-04 16:50:01.136470 [+] INFO: Executing: C:\Windows\system32\dependencies\ffmpeg\bin\ffprobe -v quiet -print_format json -show_format -show_streams -i C:\Users\GalGr\OneDrive\Desktop\Attack on Titan The Final Season 1080p Dual Audio BD Remux FLAC-TTGA\S04E01-The Other Side of the Sea.mkv
2022-02-04 16:50:01.354509 [+] INFO: Extracted frames are being saved to: C:\Users\GalGr\AppData\Local\Temp\video2x\tmpd4ezw2e1
2022-02-04 16:50:01.355009 [+] INFO: Upscaled frames are being saved to: C:\Users\GalGr\AppData\Local\Temp\video2x\tmpv42p9c68
[+] INFO: Starting upscaling video/GIF
[+] INFO: Getting total number of frames in the file
2022-02-04 16:50:01.355509 [+] INFO: Executing: C:\Windows\system32\dependencies\ffmpeg\bin\ffprobe -v quiet -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 C:\Users\GalGr\OneDrive\Desktop\Attack on Titan The Final Season 1080p Dual Audio BD Remux FLAC-TTGA\S04E01-The Other Side of the Sea.mkv
[+] INFO: Calculating scaling parameters
2022-02-04 16:56:11.777316 [+] INFO: Framerate: 23.976023976023978
2022-02-04 16:56:11.777815 [+] INFO: Width: 1920
2022-02-04 16:56:11.777815 [+] INFO: Height: 1080
2022-02-04 16:56:11.777815 [+] INFO: Total number of frames: 34440
2022-02-04 16:56:11.778316 [+] INFO: Output width: 3840
2022-02-04 16:56:11.778316 [+] INFO: Output height: 2160
2022-02-04 16:56:11.778316 [+] INFO: Required scale ratio: 2.0
2022-02-04 16:56:11.778316 [+] INFO: Upscaling jobs queue: [2.0]
2022-02-04 16:56:11.778816 [+] INFO: Executing: C:\Windows\system32\dependencies\ffmpeg\bin\ffmpeg -hwaccel auto -y -i C:\Users\GalGr\OneDrive\Desktop\Attack on Titan The Final Season 1080p Dual Audio BD Remux FLAC-TTGA\S04E01-The Other Side of the Sea.mkv -pix_fmt rgb24 C:\Users\GalGr\AppData\Local\Temp\video2x\tmpd4ezw2e1\extracted_%0d.png
2022-02-04 16:56:11.939845 [+] INFO: Main process waiting for subprocesses to exit
2022-02-04 17:04:10.948366 [+] INFO: Subprocess 7208 exited with code 0
[+] INFO: Starting to upscale extracted frames
2022-02-04 17:04:11.389849 [+] INFO: [upscaler] Subprocess 11588 executing: C:\Windows\system32\dependencies\anime4kcpp\CLI\Anime4KCPP_CLI\Anime4KCPP_CLI --passes 2 --pushColorCount 2 --strengthColor 0.3 --strengthGradient 1.0 --zoomFactor 2.0 --threads 16 --preprocessing --postprocessing --preFilters 4 --postFilters 40 --GPUMode --CNNMode --HDN --HDNLevel 1 --platformID 0 --deviceID 0 --codec mp4v --forceFps 0.0 --input C:\Users\GalGr\AppData\Local\Temp\video2x\tmpd4ezw2e1 --output C:\Users\GalGr\AppData\Local\Temp\video2x\tmpv42p9c68
2022-02-04 17:04:11.407785 [+] INFO: Starting progress monitor
2022-02-04 17:04:11.408786 [+] INFO: Starting upscaled image cleaner
2022-02-04 17:04:11.409286 [+] INFO: Main process waiting for subprocesses to exit
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   2%|6                                | 629/34440 [00:19<17:21, 32.47it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   2%|7                                | 735/34440 [00:22<16:40, 33.68it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   2%|7                                | 768/34440 [00:23<16:54, 33.18it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   2%|7                                | 804/34440 [00:24<16:34, 33.81it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   2%|8                                | 840/34440 [00:25<16:22, 34.20it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   3%|8                                | 876/34440 [00:26<16:14, 34.43it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   6%|#8                              | 1960/34440 [00:58<16:09, 33.50it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   6%|#8                              | 2000/34440 [00:59<15:30, 34.87it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   6%|#8                              | 2038/34440 [01:00<15:13, 35.48it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):   8%|##7                             | 2914/34440 [01:25<15:11, 34.60it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  10%|###1                            | 3412/34440 [01:39<14:24, 35.89it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  10%|###2                            | 3479/34440 [01:42<15:27, 33.37it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  10%|###2                            | 3516/34440 [01:43<15:13, 33.86it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  12%|###7                            | 4043/34440 [01:58<14:19, 35.35it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  12%|###7                            | 4077/34440 [01:59<14:47, 34.21it/s]libpng error: IDAT: CRC error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  13%|####2                           | 4576/34440 [02:13<13:47, 36.09it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  14%|####6                           | 4986/34440 [02:25<14:16, 34.39it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  16%|#####                           | 5461/34440 [02:39<14:41, 32.89it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  16%|#####1                          | 5496/34440 [02:40<14:49, 32.54it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  18%|#####8                          | 6284/34440 [03:02<13:20, 35.15it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  20%|######4                         | 6966/34440 [03:23<14:31, 31.51it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  25%|########1                       | 8756/34440 [04:14<12:11, 35.11it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  28%|#########                       | 9754/34440 [04:43<12:19, 33.40it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1):  30%|#########4                     | 10459/34440 [05:03<11:10, 35.75it/s]libpng error: Read Error
QPixmap::scaled: Pixmap is a null pixmap
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1): 100%|##############################9| 34406/34440 [16:33<00:01, 33.54it/s]2022-02-04 17:20:45.787420 [+] INFO: Subprocess 15064 exited with code 0
2022-02-04 17:20:45.895939 [+] INFO: Killing progress monitor
Processing: S04E01-The Other Side of the Sea.mkv (pass 1/1): 100%|##############################9| 34406/34440 [16:34<00:00, 34.59it/s]
2022-02-04 17:20:46.205994 [+] INFO: Killing upscaled image cleaner
[+] INFO: Upscaling completed
[+] INFO: Average processing speed: 34.55391372262986 seconds per frame
[+] INFO: Lanczos downscaling frames
Downscaling: 100%|##############################################################################| 34440/34440 [01:54<00:00, 301.05it/s]
[+] INFO: Converting extracted frames into video
2022-02-04 17:23:56.475034 [+] INFO: Executing: C:\Windows\system32\dependencies\ffmpeg\bin\ffmpeg -r 23.976023976023978 -hwaccel auto -y -f image2 -i C:\Users\GalGr\AppData\Local\Temp\video2x\tmpv42p9c68\extracted_%d.png -vcodec libx264 -pix_fmt yuv420p -crf 17 -vf pad=ceil(iw/2)*2:ceil(ih/2)*2 -tune animation C:\Users\GalGr\AppData\Local\Temp\video2x\tmpv42p9c68\intermediate.mkv
2022-02-04 17:23:56.675062 [+] INFO: Main process waiting for subprocesses to exit

Edit: I did some reading of the ffmpeg docs and some technical terminology I didn't know and I think I now understand what the full command to ffmpeg does. But I don't understand why it's taking so long to do this - the opposite process to what I think it's doing (creating a final file that's made out of the exported/upscaled images + the audio track(s) from the source) took much, much less time to do. Like, a matter of minutes.

@TianZerL
Copy link
Owner

TianZerL commented Feb 5, 2022

The running time of anime4kcpp on any modern GPU should be acceptable. I think some subprocess may be stuck. The anime4kcpp engine used by video2x is relatively old. I can't confirm that the problem is anime4kcpp. I suggest you put forward an issue in the video2x project. You can use Anime4KCPP GUI or Waifu2x Extension GUI instead

@GalGreenfield
Copy link
Author

Waifu2x Extension GUI

Thanks for the information and the recommendations! :)

@k4yt3x
Copy link
Contributor

k4yt3x commented Feb 27, 2022

I don't think this is A4KCPP's problem at all. I'll figure out how to integrate a newer version of A4K in 5.0.0 of video2x too.
You can close this issue since it's more likely a v2x issue.

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

No branches or pull requests

3 participants