This document describes how to pull an online video (provided in the form of URL) to VOD.
The code provided in this document is open-source and free of charge, but it may incur the following fees during use:
Fees for purchasing a Tencent Cloud CVM instance to run the API request script. For more information, please see Instance Billing Modes.
VOD storage space will be taken up by uploaded videos via pulling. For more information, please see Video Storage Pricing.
The pull from URL feature provided by VOD has the following limits:
Activate the VOD service as instructed in Getting Started - Step 1.
Go to the upload page in the VOD console, select Pull as the upload method, click Add a Row, enter the URL of the video to be pulled (the test URL is used here as an example. Other configuration items are optional, which can be entered as needed), and click Pull Video in the bottom-left corner:
Note:The time it takes to pull a video is directly proportional to the video file size. We recommend you use a small video (of dozens of megabytes in size) for the test to avoid long wait.
After waiting for one or two minutes (subject to the video file size), you can see the pulled video on the Media Assets page.
Note:If the browser is stuck at the media assets page during the pull process, you need to refresh the page to view the pulled video.
The TencentCloud API request script needs to be executed on a CVM instance meeting the following requirements:
Ubuntu Server 16.04.1 LTS 64-bit
or Ubuntu Server 18.04.1 LTS 64-bit
.For detailed directions on how to purchase a CVM instance and reinstall the system, please see Operation Guide - Creating Instances via CVM Purchase Page and Operation Guide - Reinstalling System, respectively.
Note:If you do not have a CVM instance satisfying the above conditions, you can also run the script on another Linux (such as CentOS or Debian) or macOS server with public network access, but you need to modify certain commands in the script based on the operating system. Please search for the specific modification method by yourself.
Your API key (i.e., SecretId
and SecretKey
) is required for TencentCloud API request. If you have not created an API key yet, please generate one as instructed in Root Account Access Key. If you have already created a key, please get it as instructed in the same document.
Activate the VOD service as instructed in Getting Started - Step 1.
Log in to the CVM instance prepared in step 1 as instructed in Logging into Linux Instance in Standard Login Method and enter and run the following command on the remote terminal:
ubuntu@VM-69-2-ubuntu:~$ export SECRET_ID=AKxxxxxxxxxxxxxxxxxxxxxxx; export SECRET_KEY=xxxxxxxxxxxxxxxxxxxxx;git clone https://github.com/tencentyun/vod-server-demo.git ~/vod-server-demo; bash ~/vod-server-demo/installer/pull_upload_api_en.sh
Note:Please assign the corresponding values obtained in step 2 to
SECRET_ID
andSECRET_KEY
in the command.
This command will download the demo source code from GitHub and automatically run the installation script. The installation process will take several minutes (subject to the CVM network conditions), during which the remote terminal will print the following information:
[2020-07-15 17:40:13] Start installing pip3.
[2020-07-15 17:40:39] pip3 is successfully installed.
[2020-07-15 17:40:39] Start installing the TencentCloud API SDK for Python.
[2020-07-15 17:40:42] The TencentCloud API SDK for Python is successfully installed.
[2020-07-15 17:40:42] Start configuring API parameters.
[2020-07-15 17:40:42] API parameter configuration is completed.
Run the pull_upload.py
script to initiate upload:
ubuntu@VM-69-2-ubuntu:~$ cd ~/vod-server-demo/pull_upload_api/; python3 pull_upload.py http://1400329073.vod2.myqcloud.com/ff439affvodcq1400329073/e968a7e55285890804162014755/LKk92603oW0A.mp4 API-PullUpload
Note:Please replace the URL in the command with the actual address of the video to be pulled.
This command will initiate a PullUpload request to the specified URL and print the response similar to the following:
{"TaskId": "1400329073-PullUpload-4ea60158fc6f8e611bbfa750eb1fd0a9t0", "RequestId": "4e821b4a-9a29-409f-99cb-b703fa184e50"}
After waiting for one or two minutes (subject to the video file size), you can see the pulled video on the Media Assets page.
Note:If the browser is stuck at the media assets page during the pull process, you need to refresh the page to view the pulled video.
Was this page helpful?