Skip to content

webm files don't work correctly #355

@speechwrecko

Description

@speechwrecko

Description:
Using scene detect on webm files doesn't work. With OpenCV it only loads about 2/5% of the total frame or 3-ish minutes of video. If you switch to pyav it seems to calculate the correct frames but produces the following exception when saving images

File "keyframe.py", line 94, in find_scenes
scene_images = scenedetect.scene_manager.save_images(scene_list, video, num_images=1, output_dir="temp_img")
File "/home/jason/.local/lib/python3.8/site-packages/scenedetect/scene_manager.py", line 481, in save_images
aspect_ratio = video.aspect_ratio
File "/home/jason/.local/lib/python3.8/site-packages/scenedetect/backends/pyav.py", line 214, in aspect_ratio
self._codec_context.display_aspect_ratio.numerator /
AttributeError: 'NoneType' object has no attribute 'numerator'

Example:

Include code samples that demonstrate the issue:

    video = open_video('file.webm', backend='pyav')
    scene_manager = SceneManager()
    scene_manager.add_detector(ContentDetector(threshold=threshold))
    scene_manager.detect_scenes(video)
    scene_list = scene_manager.get_scene_list()
    scene_images = scenedetect.scene_manager.save_images(scene_list, video, num_images=1, output_dir="temp_img")

Environment:

[PySceneDetect] PySceneDetect 0.6.2

Media/Files:

Appears on any webm file

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions