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

Getting absurd "Best guess" values. #12

Open
mazatov opened this issue Feb 17, 2022 · 8 comments
Open

Getting absurd "Best guess" values. #12

mazatov opened this issue Feb 17, 2022 · 8 comments

Comments

@mazatov
Copy link

mazatov commented Feb 17, 2022

I'm getting some absurd "best guess" values. Any ideas what could be wrong?

given: 1920x1080
best guess: 1449x12
all width        height
 1449 (57.05%)      12 (57.03%)
 1396 (56.10%)      16 (55.37%)
  397 (55.72%)      36 (55.37%)
  395 (55.43%)      33 (55.34%)
@0x09
Copy link
Owner

0x09 commented Mar 4, 2022

Hi @mazatov
This is fairly normal, some of those are definitely incorrect but are just above the default threshold for what's considered meaningful when resdet is looking for possible resolutions. None of these results are of particularly high confidence, so the image is likely either not upcaled or is upscaled from 1449x1080. Other detection methods (the -m option) might give different results.

@mazatov
Copy link
Author

mazatov commented Mar 4, 2022

@0x09 , thanks for your reply. I'm trying to figure out if a soccer video was upscaled. I bet it's harder for the program because most of the image is just a green field. What would be the best way/settings to run the app with to get the most accurate results.

@0x09
Copy link
Owner

0x09 commented Mar 6, 2022

@mazatov not sure doing this already, but for video it's probably best to extract 20 or so frames to y4m and provide that to resdet (there's some instructions for how to do this in the README.)
Other than that, if none of the other detection methods give a clear signal or agree, and the video is not heavily compressed, then there's a good chance it's not upscaled. If the video is moderately or heavily compressed then it may not be possible to say for sure due to the data lost from compression.

@mazatov
Copy link
Author

mazatov commented Mar 9, 2022

@0x09 , thanks again for suggestions, I'm getting Invalid image when running resdet image.y4m. Are there any special settings I need to specify when running this?

I generated y4m using this: ffmpeg -i "Path\to\myvide.mp4" -ss 1 -vframes 20 -r 5 -pix_fmt yuv420p image.y4m

Here's a zipped example generated with ffmpeg -i "video.mp4" -ss 1 -vframes 1 -pix_fmt yuv420p image.y4m for size

image.zip

@0x09
Copy link
Owner

0x09 commented Mar 10, 2022

@mazatov ah in that case you'd need to install mjpegtools' libraries, otherwise resdet builds without y4m support.

I took a look at the example and it's definitely too heavily compressed to identify with high confidence, but from the spectrogram I can make out signs of upscaling at 1440x810. resdet also identifies this with -m sign and -m mag, though it's not the top result.
1440x810 is a fairly common resolution for video to be upscaled from, so that isn't too surprising to see and makes it seem likely to me that's the actual source resolution. It's also possible that the logo or overlay are being composited on at a different resolution than the background, which can confound things further.

@mazatov
Copy link
Author

mazatov commented Mar 10, 2022

Thanks again @0x09. This is probably a dumb question, but I'm struggling to install resdet with mjpegtools support.

I install magictools using sudo apt-get -y install mjpegtools, and than try resdet ./configure and still get:

ubuntu@ip-10-0-0-81:~/games/resdet$ ./configure
Testing for cc... ok
Testing for ar... ok
Testing for pkg-config... ok

CC is "/usr/bin/cc"
AR is "/usr/bin/ar"
CFLAGS is "-Ofast -march=native -mtune=native -std=gnu99 "
PREFIX is "/usr/local"
BINPREFIX is "/usr/local/bin"
LIBPREFIX is "/usr/local/lib"
INCPREFIX is "/usr/local/include"
PCPREFIX is "/usr/local/lib/pkgconfig"

Testing for fftw3f... not found
Testing for jpeglib.h... ok
Testing for jpeg... ok
Testing for libpng... ok
Testing for mjpegtools... not found
Testing for MagickWand... ok
Testing for m... ok

@0x09
Copy link
Owner

0x09 commented Mar 11, 2022

@mazatov on Ubuntu you actually need the more specific libmjpegtools-dev package to get the relevant files for building against the mjpegtools libraries.

@mazatov
Copy link
Author

mazatov commented Mar 11, 2022

@0x09 I got it to work, thanks! I couldn't find any info about -m sign and -m mag in the repo. Could you explain the difference between running resdet with or without these properties?

BTW, I ran resdet on a big sample of 200 frames from the same video. The files is ~ 600 Mb! Here are the results.

Results on 200 frames. I"m surprised to see it suggests that the resolution is most likely correct.

ubuntu@ip-10-0-0-81:~/games/resdet$ resdet image.y4m
given: 1920x1080
best guess: 1920x810
all width        height
                   810 (59.82%)
                    21 (59.61%)
                    20 (58.86%)
                    22 (56.20%)
                    62 (55.58%)
                    63 (55.36%)
                    36 (55.24%)
                    35 (55.17%)
                    37 (55.10%)

Results on just 1 frame:

ubuntu@ip-10-0-0-81:~/games/resdet$ resdet image.y4m
given: 1920x1080
best guess: 1793x12
all width        height
 1793 (56.19%)      12 (67.09%)
 1440 (55.79%)      13 (64.83%)
  440 (55.09%)      21 (64.06%)
                   810 (62.79%)
                    20 (62.30%)
                    29 (61.73%)
                    46 (60.37%)
                    37 (59.64%)
                    22 (59.04%)
                    45 (58.93%)
                    38 (58.69%)
                    28 (58.58%)
                    30 (58.31%)
                   227 (58.22%)
                   219 (57.93%)
                    63 (57.69%)
                   235 (57.41%)
                    62 (57.07%)
                    36 (56.96%)
                   218 (56.91%)
                   210 (56.83%)
                   211 (56.72%)
                    54 (56.63%)
                   127 (56.55%)
                   128 (56.20%)
                    53 (56.18%)
                   119 (56.03%)
                   226 (56.02%)
                   228 (56.02%)
                    14 (56.00%)
                   120 (56.01%)
                    55 (55.87%)
                   236 (55.77%)
                   137 (55.61%)
                   220 (55.54%)
                    19 (55.40%)
                   136 (55.29%)
                   202 (55.30%)
                    47 (55.27%)
                   144 (55.26%)
                   194 (55.26%)
                   540 (55.24%)
                   111 (55.19%)
                    70 (55.13%)
                   145 (55.14%)
                   318 (55.15%)
                    71 (55.09%)
                   243 (55.09%)
                   343 (55.10%)
                   153 (55.04%)

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

2 participants