Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add context to Video tag page #7160

Merged
merged 8 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/source/tags/video.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,32 @@ Video tag plays a simple video file. Use for video annotation tasks such as clas

Use with the following data types: video

### Video format

Label Studio relies on your web browser to play videos, so it's essential that your videos use a format and codecs that are universally supported. To ensure maximum compatibility, we recommend using an MP4 container with video encoded using the H.264 (AVC) codec and audio encoded with AAC. This combination is widely supported across all modern browsers and minimizes issues like incorrect total duration detection or problems with playback. In addition, it's important to convert your videos to a constant frame rate (CFR), ideally around 30 fps, to avoid discrepancies in frame counts and issues with duplicated or missing frames.

Converting your videos to this recommended format will help ensure that they play smoothly in Label Studio and that the frame rate and duration are correctly recognized for accurate annotations. To convert any video to this format, you can use FFmpeg. For example, the following command converts an input video to MP4 with H.264 video, AAC audio, and a constant frame rate of 30 fps:

```bash
ffmpeg -i input_video.mp4 -c:v libx264 -profile:v high -level 4.0 -pix_fmt yuv420p -r 30 -c:a aac -b:a 128k output_video.mp4
```

In this command:
- `-i input_video.mp4` specifies your source video.
- `-c:v libx264` uses the H.264 codec for video encoding.
- `-profile:v high -level 4.0` sets compatibility parameters for a broad range of devices.
- `-pix_fmt yuv420p` ensures the pixel format is compatible with most browsers.
- `-r 30` forces a constant frame rate of 30 fps. You can also omit the -r option, ffmpeg will save your current frame rate. This is fine if you are 100% certain that your video has a constant frame rate.
- `-c:a aac -b:a 128k` encodes the audio in AAC at 128 kbps.
- `output_video.mp4` is the converted video file ready for use in Label Studio.

Using this FFmpeg command to re-encode your videos will help eliminate playback issues and ensure that Label Studio detects the total video duration accurately, providing a smooth annotation experience.

It is a good idea to check all parameters of your video using this command:
```bash
ffprobe -v error -show_format -show_streams -print_format json input.mp4
```

### Parameters

| Param | Type | Default | Description |
Expand Down
27 changes: 27 additions & 0 deletions web/libs/editor/src/tags/object/Video/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ import ObjectBase from "../Base";
* Video tag plays a simple video file. Use for video annotation tasks such as classification and transcription.
*
* Use with the following data types: video
*
* ### Video format
*
* Label Studio relies on your web browser to play videos, so it's essential that your videos use a format and codecs that are universally supported. To ensure maximum compatibility, we recommend using an MP4 container with video encoded using the H.264 (AVC) codec and audio encoded with AAC. This combination is widely supported across all modern browsers and minimizes issues like incorrect total duration detection or problems with playback. In addition, it's important to convert your videos to a constant frame rate (CFR), ideally around 30 fps, to avoid discrepancies in frame counts and issues with duplicated or missing frames.
*
* Converting your videos to this recommended format will help ensure that they play smoothly in Label Studio and that the frame rate and duration are correctly recognized for accurate annotations. To convert any video to this format, you can use FFmpeg. For example, the following command converts an input video to MP4 with H.264 video, AAC audio, and a constant frame rate of 30 fps:
*
* ```bash
* ffmpeg -i input_video.mp4 -c:v libx264 -profile:v high -level 4.0 -pix_fmt yuv420p -r 30 -c:a aac -b:a 128k output_video.mp4
* ```
*
* In this command:
* - `-i input_video.mp4` specifies your source video.
* - `-c:v libx264` uses the H.264 codec for video encoding.
* - `-profile:v high -level 4.0` sets compatibility parameters for a broad range of devices.
* - `-pix_fmt yuv420p` ensures the pixel format is compatible with most browsers.
* - `-r 30` forces a constant frame rate of 30 fps. You can also omit the -r option, ffmpeg will save your current frame rate. This is fine if you are 100% certain that your video has a constant frame rate.
* - `-c:a aac -b:a 128k` encodes the audio in AAC at 128 kbps.
* - `output_video.mp4` is the converted video file ready for use in Label Studio.
*
* Using this FFmpeg command to re-encode your videos will help eliminate playback issues and ensure that Label Studio detects the total video duration accurately, providing a smooth annotation experience.
*
* It is a good idea to check all parameters of your video using this command:
* ```bash
* ffprobe -v error -show_format -show_streams -print_format json input.mp4
* ```
*
* @example
* <!--Labeling configuration to display a video on the labeling interface-->
* <View>
Expand Down
Loading