I am trying to build a basic app using django rest api and opencv.
The app simply converts video to frame and saves to media.

I want to fetch the a video from db and apply the opencv script then save to media but I am getting an error

```
Exception Value:    
Argument 'index' is required to be an integer

```

**Model.py file**

```
from django.db import models
from django.core.files.base import ContentFile
import cv2
import tempfile
import io
import os
from .utils import get_uploaded_video

class MyVideo(models.Model):
    name= models.CharField(max_length=500)
    updated = models.DateTimeField(auto_now  =True)
    created = models.DateTimeField(auto_now_add=True)
    videofile= models.FileField(upload_to='SmatCrow/', null=True, verbose_name="")

    def __str__(self):
        return self.name + ": " + str(self.videofile)

    def save(self, *args, **kwargs):
        vid = get_uploaded_video((self.videofile))

```

opencv file **utils.py**

```
import cv2
import os
import io

def get_uploaded_video(video):
    cap= cv2.VideoCapture(video)
    i=1
    while(cap.isOpened()):
        ret, frame = cap.read()
        if ret == False:
            break
        if i%10 == 0: 

            cv2.imwrite(('new_image'+str(i)+'.jpg'),frame)
        i+=1
    cap.release()
    cv2.destroyAllWindows()

```