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.
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:
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?
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!
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 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:
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.