Uploading a video
Uploading one video
-
Open the Cloud Video home page
. -
Select a channel.
-
In the
Video tab, click Upload video. -
Click Select file on the upload page and choose the video you want to upload.
You can download videos in the following formats: MP4
, AVI , MKV , FLV , and MOV .Cloud Video limits the resolution of the videos you are publishing.
Wait for the upload to end.
-
Name your video. The title will be displayed on all the resources hosting the video.
-
In the Access field, set the access permissions for the video:
Users with permission
: Video will be available to users authorized within your organization.All users
: Video will be publicly available.
-
Optionally, to add a cover for a video, in the Thumbnail field, click
Select file and choose a cover image.The following cover formats are supported: JPG
, PNG , and GIF . -
(Optional) To add subtitles to a video, in the Subtitles field, click Add:
-
In the window that opens, select the subtitle language.
-
Click Select file and select the file with subtitles.
-
Click Create.
Wait for the file to upload.
-
-
Click Save.
This will open the video management page. After processing is complete, the video will be available for viewing.
To check the video for availability:
- Under Past code, select the
link
tab. - Click
Copy. - Open a new browser page and paste the obtained URL to the address bar.
- Click the Play button.
To create a video in Cloud Video using the API, register the video on your channel and then upload the video file over the tus
-
Register your video on the channel:
curl \ --request POST \ --url 'https://video.api.cloud.yandex.net/video/v1/videos' \ --header 'Authorization: Bearer <IAM_token>' \ --header 'Content-Type: application/json' \ --data '{ "channel_id": "<channel_ID>", "title": "<video_name>", "tusd": { "file_size": <video_file_size>, "file_name": "<video_file_name>" }, "public_access": {} }'
Where:
<IAM_token>
: IAM token required for authenticating with the Cloud Video API.<channel_ID>
: ID of the channel where you want to create the video.<video_name>
: Name the video will get when uploaded to the channel.<video_file_size>
: Size of the video file to upload, in bytes.<video_file_name>
: Name of the video file you are going to upload.
Result:
{ "done": true, "metadata": { "@type": "type.googleapis.com/yandex.cloud.video.v1.CreateVideoMetadata", "videoId": "vplvh4wvqimx********" }, "response": { "@type": "type.googleapis.com/yandex.cloud.video.v1.Video", "tusd": { "url": "https://tusd.video.cloud.yandex.net/files/75925d89ddc05c0d5ca3282781f13c6f+00062241********" }, "publicAccess": {}, "id": "vplvh4wvqimx********", "channelId": "vplcdyphvqik********", "title": "my-very-first-video", "status": "WAIT_UPLOADING", "visibilityStatus": "PUBLISHED", "createdAt": "2024-09-16T19:18:08.384540Z", "updatedAt": "2024-09-16T19:18:08.384540Z" }, "id": "vplpjlgda3c2********", "description": "Video create", "createdAt": "2024-09-16T19:18:08.393546Z", "createdBy": "ajeol2afu1js********", "modifiedAt": "2024-09-16T19:18:08.393546Z" }
Save the video upload link (
url
field value) and video ID (videoId
field value) as you will need them later. -
Upload the video file:
curl \ --location \ --request PATCH '<video_upload_link>' \ --header 'Content-Type: application/offset+octet-stream' \ --header 'Upload-Offset: 0' \ --header 'Tus-Resumable: 1.0.0' \ --data-binary '@<video_file_path>'
Where:
-
<video_upload_link>
: Previously saved upload link you got when creating the video. -
<video_file_path>
: Full video file path preceded with@
.E.g.,
@/Users/myuser/Downloads/sample-video.MOV
.Do not use any shortcuts, including
~
, in the file path.
-
-
Make sure your video file has been fully uploaded by specifying the video ID you saved before:
curl \ --request GET \ --url 'https://video.api.cloud.yandex.net/video/v1/videos/<video_ID>' \ --header 'Authorization: Bearer <IAM_token>'
Result:
{ "tusd": { "url": "https://tusd.video.cloud.yandex.net/files/75925d89ddc05c0d5ca3282781f13c6f+00062241********" }, "publicAccess": {}, "id": "vplvh4wvqimx********", "channelId": "vplcdyphvqik********", "title": "my-very-first-video", "status": "READY", "duration": "39.981s", "visibilityStatus": "PUBLISHED", "createdAt": "2024-09-16T19:18:08.384540Z", "updatedAt": "2024-09-16T19:31:31.471857Z" }
If you see
PROCESSING
orREADY
in thestatus
field, the video file has been fully uploaded. -
If you see
WAIT_UPLOADING
in thestatus
field, the video file upload was interrupted. In this case you need to resume and complete the upload. To do this, you need to know theoffset
point the previous upload attempt was interrupted at.-
Get the
offset
position of the interrupted upload using the previously saved video upload link:curl \ --head '<video_upload_link>' \ --header 'Host: tusd.video.cloud.yandex.net' \ --header 'Tus-Resumable: 1.0.0'
Result:
HTTP/1.1 200 OK Server: nginx/1.18.0 Date: Mon, 16 Sep 2024 15:21:52 GMT Connection: keep-alive Cache-Control: no-cache Tus-Resumable: 1.0.0 Upload-Length: 100100627 Upload-Metadata: filename c2FtcGxlLXZpZGVv********,video_id dnBsdjVpeWh2M2F6ZnYz******** Upload-Offset: 28231123 X-Content-Type-Options: nosniff X-Request-Id: 3b775c2a******** X-Trace-Id: 95ab2f994557ce1b1ee9dd09******** X_h: edge-5b647c8d67-***** Access-Control-Allow-Origin: * Access-Control-Allow-Headers: * Access-Control-Expose-Headers: * Expires: Thu, 01 Jan 1970 00:00:01 GMT
Save the
Upload-Offset
field value as you will need it to complete the video file upload. -
Complete the file upload by running this command:
curl \ --location \ --request PATCH '<video_upload_link>' \ --header 'Content-Type: application/offset+octet-stream' \ --header 'Upload-Offset: <offset_value>' \ --header 'Tus-Resumable: 1.0.0' \ --data-binary '@<video_file_path>'
Where:
-
<video_upload_link>
: Previously saved upload link you got when creating the video. -
<offset_value>
: Previously savedoffset
value indicating the position in the file the previous upload attempt was interrupted at. -
<video_file_path>
: Full video file path preceded with@
.E.g.,
@/Users/myuser/Downloads/sample-video.MOV
.Do not use any shortcuts, including
~
, in the file path.
-
Check once again that the video file has been fully uploaded. If the upload was interrupted again, repeat this step.
-
To create a video in Cloud Video using the API, register the video on your channel and then upload the video file over the tus
-
Register your video on the channel:
grpcurl \ -rpc-header "Authorization: Bearer <IAM_token>" \ -d '{ "channel_id": "<channel_ID>", "title": "<video_name>", "tusd": { "file_size": <video_file_size>, "file_name": "<video_file_name>" }, "public_access": {} }' \ video.api.cloud.yandex.net:443 yandex.cloud.video.v1.VideoService/Create
Where:
<IAM_token>
: IAM token required for authenticating with the Cloud Video API.<channel_ID>
: ID of the channel where you want to create the video.<video_name>
: Name the video will get when uploaded to the channel.<video_file_size>
: Size of the video file to upload, in bytes.<video_file_name>
: Name of the video file you are going to upload.
Result:
{ "id": "vplpskiedayr********", "description": "Video create", "createdAt": "2024-09-16T12:16:03.921095Z", "createdBy": "ajeol2afu1js********", "modifiedAt": "2024-09-16T12:16:03.921095Z", "done": true, "metadata": { "@type": "type.googleapis.com/yandex.cloud.video.v1.CreateVideoMetadata", "videoId": "vplvio5377ux********" }, "response": { "@type": "type.googleapis.com/yandex.cloud.video.v1.Video", "channelId": "vplcqy2qxkjy********", "createdAt": "2024-09-16T12:16:03.905662Z", "id": "vplvio5377ux********", "publicAccess": {}, "status": "WAIT_UPLOADING", "title": "my-very-first-video", "tusd": { "url": "https://tusd.video.cloud.yandex.net/files/5e7d6b3b68f9dc0d279ce719144c9caa+0006223B********" }, "updatedAt": "2024-09-16T12:16:03.905662Z", "visibilityStatus": "PUBLISHED" } }
Save the video upload link (
url
field value) and video ID (videoId
field value) as you will need them later. -
Upload the video file:
curl \ --location \ --request PATCH '<video_upload_link>' \ --header 'Content-Type: application/offset+octet-stream' \ --header 'Upload-Offset: 0' \ --header 'Tus-Resumable: 1.0.0' \ --data-binary '@<video_file_path>'
Where:
-
<video_upload_link>
: Previously saved upload link you got when creating the video. -
<video_file_path>
: Full video file path preceded with@
.E.g.,
@/Users/myuser/Downloads/sample-video.MOV
.Do not use any shortcuts, including
~
, in the file path.
-
-
Make sure your video file has been fully uploaded by specifying the video ID you saved before:
grpcurl \ -rpc-header "Authorization: Bearer <IAM_token>" \ -d '{"video_id": "<video_ID>"}' \ video.api.cloud.yandex.net:443 yandex.cloud.video.v1.VideoService/Get
Result:
{ "id": "vplva3626rvh********", "channelId": "vplcqy2qxkjy********", "title": "my-very-first-video", "status": "READY", "duration": "39.981s", "visibilityStatus": "PUBLISHED", "createdAt": "2024-09-16T14:11:04.803285Z", "updatedAt": "2024-09-16T14:14:36.467614Z", "tusd": { "url": "https://tusd.video.cloud.yandex.net/files/55994a57bd30b2161399ccab7eb5f2de+0006223D********" }, "publicAccess": {} }
If you see
PROCESSING
orREADY
in thestatus
field, the video file has been fully uploaded. -
If you see
WAIT_UPLOADING
in thestatus
field, the video file upload was interrupted. In this case you need to resume and complete the upload. To do this, you need to know theoffset
point the previous upload attempt was interrupted at.-
Get the
offset
position of the interrupted upload using the previously saved video upload link:curl \ --head '<video_upload_link>' \ --header 'Host: tusd.video.cloud.yandex.net' \ --header 'Tus-Resumable: 1.0.0'
Result:
HTTP/1.1 200 OK Server: nginx/1.18.0 Date: Mon, 16 Sep 2024 15:21:52 GMT Connection: keep-alive Cache-Control: no-cache Tus-Resumable: 1.0.0 Upload-Length: 100100627 Upload-Metadata: filename c2FtcGxlLXZpZGVv********,video_id dnBsdjVpeWh2M2F6ZnYz******** Upload-Offset: 28231123 X-Content-Type-Options: nosniff X-Request-Id: 3b775c2a******** X-Trace-Id: 95ab2f994557ce1b1ee9dd09******** X_h: edge-5b647c8d67-***** Access-Control-Allow-Origin: * Access-Control-Allow-Headers: * Access-Control-Expose-Headers: * Expires: Thu, 01 Jan 1970 00:00:01 GMT
Save the
Upload-Offset
field value as you will need it to complete the video file upload. -
Complete the file upload by running this command:
curl \ --location \ --request PATCH '<video_upload_link>' \ --header 'Content-Type: application/offset+octet-stream' \ --header 'Upload-Offset: <offset_value>' \ --header 'Tus-Resumable: 1.0.0' \ --data-binary '@<video_file_path>'
Where:
-
<video_upload_link>
: Previously saved upload link you got when creating the video. -
<offset_value>
: Previously savedoffset
value indicating the position in the file the previous upload attempt was interrupted at. -
<video_file_path>
: Full video file path preceded with@
.E.g.,
@/Users/myuser/Downloads/sample-video.MOV
.Do not use any shortcuts, including
~
, in the file path.
-
Check once again that the video file has been fully uploaded. If the upload was interrupted again, repeat this step.
-
Uploading multiple videos
-
Open the Cloud Video home page
. -
Select a channel.
-
In the
Video tab, click Upload video. -
On the upload page, click Select file and select the videos you want to upload.
You can download videos in the following formats: MP4
, AVI , MKV , FLV , and MOV .Cloud Video limits the resolution of the videos you are publishing.
Wait until all files are uploaded.
As soon as they are processed, the videos will be available for viewing.
If required, add subtitles and change the name and cover separately for each video you uploaded.