roboflow / roboflow/notebooks

Could not open video at /content/subway.mp4

Open
#267 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Jupyter Notebook
Stars
9.7k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Search before asking
  • I have searched the Roboflow Notebooks issues and found no similar bug report.
Notebook name

how-to-detect-and-count-objects-in-polygon-zone.ipynb

Bug
Exception                                 Traceback (most recent call last)
[<ipython-input-27-ef352d094252>](https://localhost:8080/#) in <cell line: 6>()
      4 generator = sv.get_video_frames_generator(SUBWAY_VIDEO_PATH)
      5 iterator = iter(generator)
----> 6 frame = next(iterator)
      7 
      8 # detect

[/usr/local/lib/python3.10/dist-packages/supervision/video.py](https://localhost:8080/#) in get_video_frames_generator(source_path)
    118     video = cv2.VideoCapture(source_path)
    119     if not video.isOpened():
--> 120         raise Exception(f"Could not open video at {source_path}")
    121     success, frame = video.read()
    122     while success:

Exception: Could not open video at /content/subway.mp4
Environment
  • Google colab
Minimal Reproducible Example
import supervision as sv

# extract video frame
generator = sv.get_video_frames_generator(SUBWAY_VIDEO_PATH)
iterator = iter(generator)
frame = next(iterator)

# detect
outputs = predictor(frame)
detections = sv.Detections(
    xyxy=outputs["instances"].pred_boxes.tensor.cpu().numpy(),
    confidence=outputs["instances"].scores.cpu().numpy(),
    class_id=outputs["instances"].pred_classes.cpu().numpy().astype(int)
)

# annotate
box_annotator = sv.BoxAnnotator(thickness=4, text_thickness=4, text_scale=2)
frame = box_annotator.annotate(scene=frame, detections=detections)

%matplotlib inline  
sv.show_frame_in_notebook(frame, (16, 16))
Additional

the file subway.mp4 is a Invalidation file .

Are you willing to submit a PR?
  • Yes I'd like to help by submitting a PR!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open how-to-detect-and-count-objects-in-polygon-zone.ipynb and inspect SUBWAY_VIDEO_PATH where get_video_frames_generator is called. Reproduce the failing frame extraction in Google Colab and verify the referenced subway.mp4 asset and path; it is done when the first frame loads and the subsequent detection cell runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, opencv, python
Domain
computer-vision
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.