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

Full Video Not fully processing #1277

Closed
ghyujkilop opened this issue Dec 29, 2024 · 12 comments
Closed

Full Video Not fully processing #1277

ghyujkilop opened this issue Dec 29, 2024 · 12 comments
Labels
state:Done This issue has been resolved/dismissed

Comments

@ghyujkilop
Copy link

ghyujkilop commented Dec 29, 2024

For some reason it speeds up the whole thing when using ESRGAN
https://www.mediafire.com/file/4emcpx806l7xn0e/extra01.wmv/file
https://www.mediafire.com/file/480bk5rtet05gtk/extra04.wmv/file
https://www.mediafire.com/file/evjrxpokobc8ge8/extra06.wmv/file

Any ideas? These are just some of the files this happens with. Other files can process normally.

I use Both Anime Presets, and standard other settings.

@github-actions github-actions bot added the state:Backlog This issue will be worked on in the future label Dec 29, 2024
@k4yt3x k4yt3x added state:InProgress This issue is being worked on and removed state:Backlog This issue will be worked on in the future labels Dec 29, 2024
@k4yt3x
Copy link
Owner

k4yt3x commented Dec 29, 2024

I'll give it a try

@k4yt3x
Copy link
Owner

k4yt3x commented Dec 29, 2024

This is some rare video format. FYI, if you first convert it into MP4, it processes fine.

ffmpeg -i extra01.asx extra01.mp4
video2x -i data/extra01.mp4 -o data/output.mkv -e crf=20 -e preset=slow -p realesrgan -s 4 --realesrgan-model realesrgan-plus

@k4yt3x
Copy link
Owner

k4yt3x commented Dec 29, 2024

output.mp4

@ghyujkilop
Copy link
Author

Anyway to have this set in the GUI?

@k4yt3x
Copy link
Owner

k4yt3x commented Dec 29, 2024

Not yet. I'll look into why it calculated the parameters incorrectly.

@ghyujkilop
Copy link
Author

Yeah, there's other videos from the same have, that are like way old, and grainy as anything. What's a good setting to keep the grain in? The upscaling seems to move faces and things around like someone mixing a pancake with a spoon.

Thank you.

@k4yt3x
Copy link
Owner

k4yt3x commented Dec 30, 2024

So I've debugged the program to see why it's playing so fast. The weird thing is that the encoder context always has the right time base:

image

... but somehow in the final video it's completely off. I don't quite understand why it's happening yet.

image

This value seems to be handled correctly in my program. Maybe it's some special behavior of the encoder.

@k4yt3x
Copy link
Owner

k4yt3x commented Dec 30, 2024

What's a good setting to keep the grain in?

If you're using RealCUGAN, you can tune the noise settings. Make it lower to preserve more texture/grain. Other models are not tunable.

On the encoder's side, you can set the tune of the encoder like tune = grain for H.264 (ref).

@k4yt3x
Copy link
Owner

k4yt3x commented Dec 30, 2024

So I did some tests and checked the math again, the original frame rate calculates to 1000 / 11 == ~90.909 FPS. It's either an upstream bug or a broken file. This readout is from FFmpeg's FFprobe:

image

It's upstream. Even if you convert the file with FFmpeg, the framerate changes. I don't think there's anything to fix in Video2X.

@k4yt3x k4yt3x closed this as completed Dec 30, 2024
@github-actions github-actions bot added state:Done This issue has been resolved/dismissed and removed state:InProgress This issue is being worked on labels Dec 30, 2024
@k4yt3x
Copy link
Owner

k4yt3x commented Dec 30, 2024

I think what might have happened here is that your video is using a timestamp that doesn't match the declared frame rate. You can convert it and manually set the framerate:

ffmpeg -i extra01.wmv -r 1 extra01.mp4

The -r 1 here means 1 FPS. This will "fix" the file and allow it to be processed correctly.

@ghyujkilop
Copy link
Author

Is there not a way using the back end to be able to identify what sort of file has been inputted? (When using the GUI I mean)

And also regarding the GUI, where might I find the grain setting? And how would the adjustment with that work?

Thank you for digging into this.

@k4yt3x
Copy link
Owner

k4yt3x commented Dec 30, 2024

The program has no issue identifying "what sort of file has been inputted." The issue is that your file (add a custom option):

  • contains incorrect metadata (i.e., a broken file); and
  • it is FFmpeg's C library that's having trouble working with it, not Video2X.

As for gain settings, you can add a custom option like this to set tune to grain for H.264:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:Done This issue has been resolved/dismissed
Projects
None yet
Development

No branches or pull requests

2 participants