Morph is implemented in Python!
Morph is an open source cloud transcoding system. It can leverage the scalability of the cloud infrastructure to encode and transcode the video files in fast speed, and dynamically provision the computing resource to accommodate the time-varying workload.
Installation
System Requirement
Interface Layer
It interacts with the users for processing the transcoding requests and preprocessing the video contents. The system provides 3 types of service interfaces, namely, command line interface (CLI), remote procedure call (RPC), and RESTful API. The users can submit the transcoding tasks and query the transcoding progress via the service interfaces. For each of the user submitted transcoding tasks, it will estimate the required computing time for the task and segment the video files into video blocks for transcoding in parallel on the workers.
Scheduling Layer
The user submitted transcoding tasks will be put into the scheduling queue. The task scheduler sequences the pending tasks in the queue according to the scheduling policy and the QoS profiles of the tasks. Whenever the master node receives a transcoding request from the worker, the task scheduler will select a video block from the pending tasks for dispatching by applying the scheduling policy. The transcoded video blocks on the worker will be sent back to the master for concentration.
Provisioning Layer
It manages the transcoding workers for dynamic resource provisioning. Our system can adapt the virtual machines (e.g., KVM ) or containers (e.g., Docker) for resource virtualization. Each VM instance or container runs a worker. The worker will request a video block from the master node whenever it idle. The worker will transcode the video block into the target representations, which will be sent back to the master node.
It can be accessed via RESTful API, command line interface (CLI), and RPC!
We adopt SimpleXMLRPCServer for implementing RPC, the APIs for submitting transcoding task and querying task status are as follows:
public function _rpc() { $request = xmlrpc_encode_request('put_trans_task', array( 'http://aidynamic.com/video/bunny.mp4', '2000', '420', '240', '5')); $context = stream_context_create(array('http' => array( 'method' => "POST", 'header' => "Content-Type: text/xml", 'content' => $request ))); $file = file_get_contents('http://127.0.0.1:8888', true, $context); $response = xmlrpc_decode($file); if (is_array($response) && xmlrpc_is_fault($response)) { return ($response); } else { return ($response); } }