A task represents a single instance of a transcoding job that applies a particular template to a specific source video. When you create a task, you choose the desired template, provide the input video’s location, and specify an output path along with a storage destination. The AuroraCloud VOD service then processes the input video according to all the parameters defined in the referenced template, delivering a transcoded output. Tasks can be monitored to track real-time status (e.g., “running,” “succeeded,” or “failed”) and can be queried to retrieve information such as start time, end time, and error messages if any issues occur during processing.
This document will guide you through the process of creating a task, including setting up inputs, selecting templates, and configuring outputs. Please ensure that your input files are ready and the Output is properly configured.
Step 1: Log in to the Console
Step 2: Navigate to the Task Page
After logging in, select VOD -> Task from the left navigation bar.
Step 3: Create a New Task
On the Task page, click the Create a new Task button.
Step 4: Set Up Input
Currently, three input methods are supported:
Video URL: Enter the URL link of the video file.
Upload Video: Upload a local video file.
Sample Video: Select a sample video provided by the system.
Step 5: Select a Template
Currently, two types of templates are supported:
Custom Template: Customize the task processing template according to your needs.
Predefined: Choose a system-predefined template.
Step 6: Configure Output
Click Select to choose a pre-configured Output.
Set the Output Filename to specify the name of the output file.
Completion
After completing the above steps, click Confirm to successfully create the task.
Important Notes
Ensure that the input file or URL is valid to avoid task failure.
If selecting a custom template, configure the template parameters in advance.
Ensure that the Output is correctly configured so that the task results can be successfully exported.
Creating a Transcoding Task via API
import requestsfrom typing import Optionaldef create_transcode_task(api_key: str, api_secret: str, template_name: str, input_file: str, output_file: str, storage_id: str) -> Optional[str]:"""Create a transcoding taskArgs:api_key: Access Key ID for API authenticationapi_secret: Access Key Secret for API authenticationtemplate_name: Name of the transcoding templateinput_file: URL or path of the input fileoutput_file: Path for the output filestorage_id: ID of the storage spaceReturns:Task ID if successful, None if failed"""url = "https://api.visionular.com/vodencoding/v1/create_task"headers = {"Content-Type": "application/json","auth-type": "use-basic"}payload = {"template_name": template_name,"input": input_file,"output": output_file,"storage_id": storage_id}try:response = requests.post(url,headers=headers,auth=(api_key, api_secret),json=payload,verify=True)response.raise_for_status()result = response.json()if result["code"] == 0:task_id = result['data']['task_id']print(f"Transcoding task created successfully! Task ID: {task_id}")return task_idelse:print(f"Creation failed: {result['msg']}")return Noneexcept requests.exceptions.RequestException as e:print(f"Request error: {e}")return None# Example usageif __name__ == "__main__":api_key = "your_api_key"api_secret = "your_api_secret"template_name = "System_DASH_MP4_H264"input_file = "https://dangjin-iptest.oss-cn-beijing.aliyuncs.com/rakuten-japan/1102553305.mp4"output_file = "output_dash/1102553305_2_dash.mpd"storage_id = "34b3cad70dbf8ee1"task_id = create_transcode_task(api_key, api_secret, template_name, input_file, output_file, storage_id)if task_id:print(f"Task created successfully. Task ID: {task_id}")