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

Exception in _init_video_manager() when video fails to load on non-Windows platforms #192

Closed
paulagd opened this issue Nov 10, 2020 · 4 comments
Labels
Milestone

Comments

@paulagd
Copy link

paulagd commented Nov 10, 2020

Bug/Issue Description:
I am trying to run the detection in my sample video but it fails like:

scenedetect -i sample_seconds.mp4 detect-content list-scenes -n save-images

> scenedetect -i sample_seconds.mp4 detect-content list-scenes -n save-images
[PySceneDetect] Could not parse CLI options.
Traceback (most recent call last):
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/scenedetect/cli/c
ontext.py", line 517, in _init_video_manager
    video_files=input_list, framerate=framerate, logger=logging)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/scenedetect/video
_manager.py", line 373, in __init__
    video_files=video_files, framerate=framerate)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/scenedetect/video
_manager.py", line 241, in open_captures
    raise VideoOpenFailure(closed_caps)
scenedetect.video_manager.VideoOpenFailure: OpenCV VideoCapture object failed to return True
 when calling isOpened().

During handling of the above exception, another exception occurred:
Traceback (most recent call last):                                                  [3/1926]
  File "/home/paulagomez/.virtualenvs/research/bin/scenedetect", line 8, in <module>
    sys.exit(main())
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/scenedetect/__mai
n__.py", line 58, in main
    cli.main(obj=cli_ctx)   # Parse CLI arguments with registered callbacks.
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/click/core.py", l
ine 782, in main
    rv = self.invoke(ctx)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/click/core.py", l
ine 1268, in invoke
    Command.invoke(self, ctx)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/click/core.py", l
ine 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/click/core.py", l
ine 610, in invoke
    return callback(*args, **kwargs)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/click/decorators.
py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/scenedetect/cli/$
_init__.py", line 293, in scenedetect_cli
    frame_skip=frame_skip)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/scenedetect/cli/$
ontext.py", line 586, in parse_options
    input_list=input_list, framerate=framerate, downscale=downscale)
  File "/home/paulagomez/.virtualenvs/research/lib/python3.6/site-packages/scenedetect/cli/$
ontext.py", line 526, in _init_video_manager
    dll_okay, dll_name = check_opencv_ffmpeg_dll()
TypeError: 'bool' object is not iterable

Computing Environment:

  • OS: Ubuntu 18.04.4 LTS
  • Python Version: 3.6.9
  • OpenCV Version: opencv-python 4.4.0.46

Additional Information:
I have also installed:

ffmpeg                    1.4
imageio-ffmpeg            0.4.2

Can someone tell me what am I doing wrong please?

Thank you in advance!

@Breakthrough
Copy link
Owner

Hi @paulagd;

Sorry for the delay in getting back to you. The command is correct, for some reason though it is failing to load the .mp4 using the underlying OpenCV library. This, however, results in another exception getting thrown due to a bug in check_opencv_ffmpeg_dll() (it works on Windows, but this will happen on any other platform).

I'll mark this as a bug, but note that the issue is likely caused by OpenCV/ffmpeg being unable to open your test video for some reason. You can test this yourself by trying to open the file manually via OpenCV, and checking if you are able to do it (I can provide some sample code for you to run if you aren't as familiar with OpenCV).

Thanks!

@Breakthrough Breakthrough changed the title VideoCapture fails when detecting scenes in dummy video Exception in _init_video_manager() when video fails to load on non-Windows platforms Jan 10, 2021
@Breakthrough Breakthrough added this to the v0.5.5 milestone Jan 10, 2021
Breakthrough added a commit that referenced this issue Jan 10, 2021
platforms causing unhandled exception (resolves #192).
@Breakthrough
Copy link
Owner

Resolved in v0.5.5 branch, will be included in next release of PySceneDetect, should give you the proper error messaging now.

As for why the video fails to load, that will still require some more investigation. Feel free to respond to this issue, or create a new one for that.

@Breakthrough
Copy link
Owner

How did you generate your sample video? Are you sure it's a valid file? How did you install opencv-python? Could you possibly include your test video file on this issue to help with the analysis?

Thanks!

@Breakthrough
Copy link
Owner

Hi @paulagd;

I'm closing this issue due to resolving the improper error messaging. As mentioned, if you could attach the test video you are using, that would be a great help to narrow down why it's failing on your end. Feel free to respond to this issue, or create a new one, if you are still running into this issue after the next release (v0.5.5).

Thank you again for the report.

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

No branches or pull requests

2 participants