# Importing Video Pre-Annotations

**URL:** <https://community.labelstud.io/t/importing-video-pre-annotations/251>\
**Category:** Label Studio Support\
**Tags:** video, annotations\
**Created:** [June 18, 2024, 7:24pm UTC](https://community.labelstud.io/t/importing-video-pre-annotations/251 "2024-06-18T19:24:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amykar](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@amykar](https://community.labelstud.io/u/amykar)\
**Post date:** [June 18, 2024, 7:24pm UTC](https://community.labelstud.io/t/importing-video-pre-annotations/251/1 "2024-06-18T19:24:54Z")

</div>

What is the format for video preannotations? I have frames labelled locally, how can I compile this to import as video annotations into label studios?

---

<div class="post-metadata">

**Author:** ![sajarin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/sajarin/32/56_2.png) [@sajarin](https://community.labelstud.io/u/sajarin)\
**Post date:** [June 21, 2024, 9:51am UTC](https://community.labelstud.io/t/importing-video-pre-annotations/251/2 "2024-06-21T09:51:15Z")

</div>

To import video preannotations into Label Studio, you need to format your data in the Label Studio JSON format. Here’s how you can compile your locally labeled frames into the required format:

1. **Labeling Configuration** :  
Ensure your labeling configuration in Label Studio is set up for video annotation. For example:

```auto
   <View>
     <Video name="video" value="$video" framerate="25.0"/>
     <VideoRectangle name="box" toName="video" />
     <Labels name="videoLabels" toName="video" allowEmpty="true">
       <Label value="Object1" background="blue"/>
       <Label value="Object2" background="red"/>
     </Labels>
   </View>

```

1. **JSON Format for Preannotations** :  
Your JSON file should include the video URL and the preannotations. Here’s an example structure:

```auto
{
 "data": {
   "video": "https://example.com/path/to/your/video.mp4"
 },
 "predictions": [
    {
     "model_version": "v1",
     "result": [
       {
          "id": "N-9HJ5jjVS",
          "type": "videorectangle",
          "value": {
            "labels": [
              "Man"
            ],
            "duration": 61.391021,
            "sequence": [
              {
                "x": 15.449804432855279,
                "y": 36.324786324786324,
                "time": 0.04,
                "frame": 1,
                "width": 13.820078226857888,
                "height": 19.23801245835144,
                "enabled": true,
                "rotation": 0
              },
              {
                "x": 27.70534550195567,
                "y": 33.77517021584817,
                "time": 0.48,
                "frame": 12,
                "width": 13.820078226857884,
                "height": 19.238012458351434,
                "enabled": true,
                "rotation": 0
              }
            ],
            "framesCount": 1535
          },
          "origin": "manual",
          "to_name": "video",
          "from_name": "box"
        }
      ]
    }
  ]
}

```

1. **Key Elements** :
  - data: Contains the video URL.
  - predictions: An array of prediction objects.
  - result: An array of regions, there is only one region (bbox) that contains a sequence of frames.
  - value: Contains the label name of the bbox.
  - sequence: Contains the coordinates, dimensions, time and frame number for each frame.

2. **Importing Preannotations** :
  - Go to your Label Studio project.
  - Navigate to the Data Manager and select Import.
  - Upload your JSON file.

For more details, you can refer to the Label Studio documentation on preannotations. If you have any specific questions or need further assistance, feel free to ask!

---

<div class="post-metadata">

**Author:** ![Zubair\_Hussain](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/zubair_hussain/32/141_2.png) [@Zubair\_Hussain](https://community.labelstud.io/u/Zubair_Hussain)\
**Post date:** [September 11, 2024, 2:41pm UTC](https://community.labelstud.io/t/importing-video-pre-annotations/251/3 "2024-09-11T14:41:44Z")

</div>

I’m trying to import videos with frame size (640 x 480), but when I generate annotation it has frame size of (100 x 100).  
What is the frame size for videos in label studio? Can I update the frame size of the video?

---

<div class="post-metadata">

**Author:** ![Zubair\_Hussain](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/zubair_hussain/32/141_2.png) [@Zubair\_Hussain](https://community.labelstud.io/u/Zubair_Hussain)\
**Post date:** [September 11, 2024, 3:04pm UTC](https://community.labelstud.io/t/importing-video-pre-annotations/251/6 "2024-09-11T15:04:01Z")

</div>

![Screenshot 2024-09-11 at 4.01.15 PM (2)](https://canada1.discourse-cdn.com/flex035/uploads/labelstudio/original/1X/dd156008ba7db7e07b2abc4dc10e7e84577dec18.png)

The video I upload has a resolution of (640 x 480), and when I generate annotation (bbox) on bottom-right corner, I get the coordinates provided in the screenshot.

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [September 11, 2024, 4:17pm UTC](https://community.labelstud.io/t/importing-video-pre-annotations/251/7 "2024-09-11T16:17:55Z")

</div>

Check how videorectangles are created for YOLO video tracking in LS ML backend model:

> <https://github.com/HumanSignal/label-studio-ml-backend/blob/master/label_studio_ml/examples/yolo/control_models/video_rectangle.py#L86-L144>
