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

Inconsistent error handling when start time exceeds video length #380

Open
3 tasks
Breakthrough opened this issue Feb 19, 2024 · 0 comments
Open
3 tasks

Comments

@Breakthrough
Copy link
Owner

Breakthrough commented Feb 19, 2024

Description:

When using different backends with the CLI, setting start time to be beyond the end of the video will result in different behaviour. This should be made consistent if possible, otherwise the differences should be documented. Summary of differences:

  • OpenCV: Incorrect error message.
  • PyAV: Processes last frame.
  • MoviePy: Inconsistent error message due to wrong logger used when handling SeekError

Output:

Command: scenedetect -i goldeneye.mp4 time -s 10000

OpenCV:

[PySceneDetect] PySceneDetect 0.6.2
[PySceneDetect] Downscale factor set to 5, effective resolution: 256 x 108
[PySceneDetect] Detecting scenes...
  Detected: 0 | Progress: : 0frames [00:00, ?frames/s]
[PySceneDetect] Failed to read any frames from video file. This could be caused by the video having multiple audio tracks. If so, try installing the PyAV backend:
      pip install av
Or remove the audio tracks by running either:
      ffmpeg -i input.mp4 -c copy -an output.mp4
      mkvmerge -o output.mkv input.mp4
For details, see https://scenedetect.com/faq/

PyAV:

[PySceneDetect] PySceneDetect 0.6.2
[PySceneDetect] Downscale factor set to 5, effective resolution: 256 x 108
[PySceneDetect] Detecting scenes...
  Detected: 0 | Progress: : 0frames [00:00, ?frames/s]
[PySceneDetect] Processed 0 frames in 0.1 seconds (average 0.00 FPS).
[PySceneDetect] Detected 1 scenes, average shot length 0.0 seconds.
[PySceneDetect] Scene List:
-----------------------------------------------------------------------
 | Scene # | Start Frame |  Start Time  |  End Frame  |   End Time   |
-----------------------------------------------------------------------
 |      1  |        1980 | 00:01:22.541 |        1980 | 00:01:22.582 |
-----------------------------------------------------------------------

MoviePy:

[PySceneDetect] PySceneDetect 0.6.2
CRITICAL:root:Failed to seek to 00:06:57.042 / frame 9999: Target frame is beyond end of video!

Action Items

  • Correct logger used to report seek failures
  • Ensure all backends either throw a SeekError when attempting to seek() past EOF or that they all gracefully stop at "one-past" the last frame
  • Ensure incorrect error messaging for Scenedetect fails on mp4 video with multiple audio tracks #179 is not displayed when no frames have been processed
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

1 participant