Videos not uploading

Dear all, very nice to meet you!

I am having issues uploading videos to Roboflow. They are mp4, around 10 GB, and I usually use a frame rate of 30.1 seconds (between 50 to 100 pictures). This is the first time I have encountered this problem, I have been working on my project (it is an object detection type) for a couple of weeks using the same type of files, and everything worked fine.

Whenever I try to upload, I see a progress bar running, but the page goes unresponsive. I have attempted to drag and select files, but nothing was uploaded.

I believe my operating system (Windows 10), browser (Chrome), and the file formats of the videos are compatible, and I’ve checked, and I am not running out of storage or usage. I’ve also tried to use a VPN to see if that would help the problem, but it didn’t work either.

I have checked the page console, and according to it, I have this error: cess to XMLHttpRequest at ‘https://hog.roboflow.com/decide/?v=3&ip=1&_=1681807386550&ver=1.43.0’ from origin ‘https://app.roboflow.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Screen shot of the problem:

Can you please help me figure out how to fix this, please
Thanks!

Hi @AndyEz, the file size you are processing is likely causing a memory issue.

I have a script here you can use to process the frames in your video to split them:

#!pip install opencv-python-headless

import os
import cv2
import argparse

def main(
    video_path: str,
    active_learning: bool,
    raw_data_location: str = ".",
    raw_data_extension: str = ".jpg",
    fps: int = 1,
):
    video = cv2.VideoCapture(video_path)
    frame_number = 0
    total_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
    skip_frames = int(video.get(cv2.CAP_PROP_FPS) // fps)
    sampled_frames = []

    while frame_number < total_frames:
        video.set(cv2.CAP_PROP_POS_FRAMES, frame_number)
        ret, frame = video.read()

        if not ret:
            break

        if active_learning:
            active_learning_frames = os.path.join(raw_data_location + "/sampled_frames")
            if os.path.exists(active_learning_frames) is False:
                os.mkdir(active_learning_frames)
        
        frame_path = os.path.abspath(active_learning_frames + f"/frame_{frame_number:04d}{raw_data_extension}")
        sampled_frames.append(frame_path)
        print(frame_path)
        if os.path.exists(frame_path) is False:
            cv2.imwrite(frame_path, frame)

        frame_number += skip_frames

        # Press 'q' to exit the loop
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    video.release()
    cv2.destroyAllWindows()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="sampling videos by a specified frames per second of video.")
    parser.add_argument("video_path", type=str, help="Path to the video file.")
    parser.add_argument("--raw_data_location", type=str, default=f"{os.curdir}", help="Location to save frames.")
    parser.add_argument("--raw_data_extension", type=str, default=".jpg", help="Image extension for saved frames.")
    parser.add_argument("--fps", type=int, default=1, help="Frames per second to sample from the video.")

    args = parser.parse_args()

    main(
        args.video_path,
        args.raw_data_location,
        args.raw_data_extension,
        args.fps,
    )

Example usage is below:

  • Note: The --fps argument is an integer value that equates to the frames to sample per second of video in your file – if your video has an fps of 30, and you set --fps=2, then you will sample 2 frames for every second of video
  • enter this in your terminal, after saving the filename as save_vidframes.py:
python3 sample_vidframes.py --video_path="/Downloads/mohamed-videofile.mp4" \
--raw_data_location="/PATH_TO_CREATE_DIR_FOR_SAVED_FRAMES" \
--raw_data_extension=".jpg" \
--fps=2

After running the script, add the frames to Roboflow by dropping them in

There’s also the option to Upload Videos via API: Video - Roboflow

Hi Mohamed! Thank you very much for your reply and for that helpful script! I really appreciated.
I don’t think is the size of the videos causing the problem because I also try uploading pictures and it is giving me the same mistake, unresponsive page. Any other ideas?

@AndyEz ohh I see - I’m adding a note for my team to resolve your CORS issue when they return in the morning (United States time).

It may be related to this:

I’ll be in touch for updates.

Thank you very much for your help!
I will be waiting for the updates
Cheers!

@AndyEz Can you try the upload process again?

This time, with your devtools console open, and while screen recording?

You can screen record with a software of your choice, or use https://loom.com and share the video to help@roboflow.com

When you complete the video, send the video link to help@roboflow.com, too.

We can then look at this fix again. We couldn’t find anything immediately, so the devtools Console and Network tab view should help us.

I’ve selected the timestamp in this video that begins with showing how to open Console and Network tabs, and begin screen-recording:

Hello Mohamed!, Thank you very much for your quick reply, and I am very sorry for my very late one. I was on the field in a remote place without internet, so I could only check my messages today. I tried uploading the video today, and it works perfectly again! Thank youuuuuuu! I don’t know if you changed something, but it worked! If something else happens, I will contact you, but for now, everything is perfect! Cheers!

1 Like

Hello @Mohamed ! its me again, I told you that I will contact you if I had more issues after the last one… so… I think I have some issues again :sweat_smile: sorry about that.
Now my videos are uploading correctly, but when I want to change the image to the next it gives me an error, and doesn’t allow me to change pictures and continue my annotations. Here is an example of the error:

Can you help me fix this please?

Thank youuuuuu
Andy

Hi @AndyEz - can you try a network speed test while you have the Roboflow App open?

Also - are you on a VPN, or just connected via regular wi-fi or ethernet?

Hi @Mohamed !
I am connected to ethernet. My network speed is 1.0 Gbps
I did a test (speedtest.net) and it shows download: 458.34 Mbps and upload 825.89 Mbps (I’m not sure if that’s what you mean)
and still the page is unresponsive.