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

0% processed, no scenes detected - Bluray MKV #186

Closed
adworacz opened this issue Oct 5, 2020 · 6 comments
Closed

0% processed, no scenes detected - Bluray MKV #186

adworacz opened this issue Oct 5, 2020 · 6 comments

Comments

@adworacz
Copy link

adworacz commented Oct 5, 2020

Bug/Issue Description:
Unable to detect/process Bluray MKV at all, scenedetect just exits instantly with no obvious logs.

Required Information:
Provide the following information to assist with reporting the bug:

  1. Provide a full copy of the command line options you are using, for example:

scenedetect -i The\ Martian\ -\ Extended\ Edition_t02.mkv -v debug detect-content

  1. Add -v debug -l BUG_REPORT.txt to the beginning of the command, then re-run PySceneDetect and attach the generated BUG_REPORT.txt file.

I was unable to, and it produced the following error:

~/Videos/The Martian - Extended Edition >>> scenedetect -v debug -l BUG_REPORT.txt -i The\ Martian\ -\ Extended\ Edition_t02.mkv detect-content
Traceback (most recent call last):
  File "/usr/bin/scenedetect", line 33, in <module>
    sys.exit(load_entry_point('scenedetect==0.5.2', 'console_scripts', 'scenedetect')())
  File "/usr/lib/python3.8/site-packages/scenedetect/__main__.py", line 58, in main
    cli.main(obj=cli_ctx)   # Parse CLI arguments with registered callbacks.
  File "/usr/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 1268, in invoke
    Command.invoke(self, ctx)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/scenedetect/cli/__init__.py", line 261, in scenedetect_cli
    logfile = ctx.obj.get_output_file_path(logfile)
AttributeError: 'CliContext' object has no attribute 'get_output_file_path'

Removing the -l BUG_REPORT.txt produce the following:

~/Videos/The Martian - Extended Edition >>> scenedetect -i The\ Martian\ -\ Extended\ Edition_t02.mkv -v debug detect-content                        [1]
DEBUG: context.parse_options(): Parsing program options.
DEBUG: context._init_video_manager(): Initializing VideoManager.
INFO: video_manager.__init__(): Loaded 1 video, framerate: 23.98 FPS, resolution: 1920 x 1080
INFO: video_manager.set_downscale_factor(): Downscale factor set to 6, effective resolution: 320 x 180
DEBUG: context.parse_options(): VideoManager initialized.
DEBUG: __init__.detect_content_command(): Detecting content, parameters:
  threshold: 30, min-scene-len: 14
DEBUG: context.process_input(): Processing input...
INFO: context.process_input(): Detecting scenes...
  0%|                                                                                                                     | 0/217718 [00:00<?, ?frames/s]
INFO: context.process_input(): Processed 0 frames in 0.1 seconds (average 0.00 FPS).
INFO: context.process_input(): Detected 1 scenes, average shot length 0.0 seconds.
DEBUG: context.cleanup(): Cleaning up...

Expected Behavior:
I expected scenedetect to scan the file in question and produce a timecode list of scenes, just like it does on the DVD below.

Computing Environment:

  • OS: Linux (Manjaro)
  • Python Version: 3.8.5
  • OpenCV Version: 4.4.0
  • Scenedetect version: 0.5.2

Additional Information:
I tried in on a DVD MKV (both produced using MakeMKV on this same machine) and it worked just fine.

Sample output below from successful run. Same machine, same day, same software install.

~/Videos/DARK_FURY >>> scenedetect -i title_t00.mkv detect-content
[PySceneDetect] Loaded 1 video, framerate: 29.97 FPS, resolution: 720 x 480
[PySceneDetect] Downscale factor set to 3, effective resolution: 240 x 160
[PySceneDetect] Detecting scenes...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 62648/62648 [00:56<00:00, 1111.42frames/s]
[PySceneDetect] Processed 62648 frames in 56.4 seconds (average 1111.33 FPS).
[PySceneDetect] Detected 500 scenes, average shot length 4.2 seconds.
[PySceneDetect] Comma-separated timecode list:
@adworacz
Copy link
Author

adworacz commented Oct 5, 2020

Adding a mediainfo dump as well, in case it helps.

mediainfo.txt

@Breakthrough
Copy link
Owner

Breakthrough commented Oct 6, 2020

Hey @adworacz;

Unfortunately PySceneDetect cannot handle files with multiple audio tracks correctly. Updated error information has been added in the latest version with the following workaround (on the FAQ):

https://pyscenedetect.readthedocs.io/en/latest/faq/#how-can-i-fix-the-error-failed-to-read-any-frames-from-video-file

The best I can do for now is to suggest removing the audio tracks if possible via:

mkvmerge -o output.mkv input.mkv

Sorry about the inconvenience. Will close this as a dupe of #179 if that's okay with you? I just don't want to create a huge temporary file on users systems when this occurs, so hoping the updated error messaging makes sense.

@adworacz
Copy link
Author

adworacz commented Oct 6, 2020

Edit: I do seem to be two versions behind, so I'll try updating as well.

I'm not sure if that's the same issue - I'm not receiving that error, and if I use it on the same version of a movie that's passed through Handbrake encoding, which has multiple audio tracks, it works just fine.

I admit, the underlying codecs for the audio and video are completely different, but both utilize the same number of frames and multiple audio tracks.

Here's proof:

~/Videos/The Martian - Extended Edition >>> scenedetect -i The\ Martian\ -\ Extended\ Edition_t01-handbrake-version.mkv detect-content
[PySceneDetect] Loaded 1 video, framerate: 23.98 FPS, resolution: 1920 x 800
[PySceneDetect] Downscale factor set to 6, effective resolution: 320 x 133
[PySceneDetect] Detecting scenes...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████▉| 203739/203740 [10:02<00:00, 337.88frames/s]
[PySceneDetect] Processed 203739 frames in 603.0 seconds (average 337.87 FPS).
[PySceneDetect] Detected 2358 scenes, average shot length 3.6 seconds.
[PySceneDetect] Comma-separated timecode list:
  00:00:02.002,00:00:05.756,00:00:22.940,00:00:23.899,00:00:25.859,00:00:26.443,00:00:32.157,00:00:36.578,00:00:38.330,00:00:38.997,00:00:42.084,00:00:42.834,00:00:43.752,00:00:44.419,00:00:46.046,00:00:54.930,00:01:26.878,00:01:49.234,00:02:15.344,00:02:19.806,00:02:23.143,00:02:26.229,00:02:28.607,00:02:31.818,00:02:33.862,00:02:38.533,00:02:40.577,00:02:41.953,00:02:47.834,00:02:51.004,00:0... blah blah blah

With that video's media info:
mediainfo-handbrake.txt

@adworacz
Copy link
Author

adworacz commented Oct 6, 2020

Okay, I updated to the latest version from git, and I AM receiving that error now.

As you say, extracting the video out does allow for pyscenedetect to run.

It is interesting that some videos with multiple audio tracks work, and others don't...

So yes, feel free to close this as a duplicate.

@Breakthrough
Copy link
Owner

Hello @adworacz;

Thanks for getting back to me on that. I thought that it affected every video with multiple audio tracks, so that is new information to me. Are you able to share a small sample that triggers the issue out of curiosity? I would like to store it for future reference when I'm able to revisit this issue... If not though, no worries!

Eventually I would like to see if it's possible to rewrite PySceneDetect using a lower-level ffmpeg library for doing the video I/O, or perhaps doing it in C++ via the SceneStats project. These are far in the future unfortunately, so for now PySceneDetect is kind of stuck using the OpenCV VideoCapture API, which doesn't really help much with debugging these kinds of issues.

Sorry for the inconvenience, and thanks for the report.

@Breakthrough
Copy link
Owner

I'm now wondering if this was actually related to something similar to Breakthrough/DVR-Scan#62 where the first frame actually can't be decoded for some reason. Reaching out to folks to see if anyone can share a minimal working example (as short of a clip as possible exhibiting this issue). Thank you!

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

No branches or pull requests

2 participants