Using encoding.com for video encoding, and storage on S3?

Keyz - July 20, 2009 - 08:41
Project:Media Mover
Version:6.x-1.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

A client's site I'm working on is interested in using Encoding.com for off-site encoding of video files (instead of local FFMPEG), as well as final storage/serving of the files on Amazon S3. The videos would ultimately be connected to a node for each, owned by the user who uploaded it. Encoding.com is able to send its encoded files directly to S3 after completion. I wanted to see if this might be a possible scenario for Media Mover? Would an additional sub-module need to be created to accomplish this? If so, any hints as to what it might entail to accomplish this would be greatly appreciated :) Encoding.com has expressed interest (when my client spoke to them) in a solution for Drupal, so anything that might help clarify what it would take to accomplish would be very helpful.

Thanks in advance :)

#1

godewebog - September 13, 2009 - 23:26

Have anybody started to work on it? It would be a very useful and popular module.

#2

arthurf - September 15, 2009 - 04:31

You could probably do something like this. You basically just need to fill in the last function and you're good to go.

<?php

/**
* Implementation of media_mover hook
* @param $op is the operator to return
* @param $action is which action is being called
* @param $verb is the verb being run
* @param $configuration is the specific configuration saved for the action for this configuration
* @param $file is the file in use
* @param $job is the full configuration data currently running
*/
function encoding_media_mover($op = null, $action = null, $configuration = null, &$file = array(), $job = null, $nid = null ) {
  switch (
$op) {
   
// give your module a distinct name
   
case 'name':
      return
"Media Mover Encoding.com";
    break;

   
// defines the actions that this module does
   
case 'actions':
      return array(
       
'process' => array(
         
1 => t('Send file to Encoding.com'),
        ),
      );
    break;

   
// create edit configuration option set
   
case 'config':
      return
encoding_config($configuration);
    break;

    case
'process':
      return
encoding_process($file, $configuration);
    break;
  }
}

/**
* Creates the configuration form
* @param $configuration
* @return array
*/
function encoding_config($configuration) {
 
// some drupal form elements here
 
$form['encoding_user'] = array(
   
'#type' => 'textfield',
   
'#title' => t('Encoding.com user'),
   
'#default_value' => $configuration['encoding_user'],
   
'#description' => t('Enter your user'),
  );
  return
$form;
}

/**
* move the file to encoding.com
* @param $file
* @param $configuration
*/
function encoding_process($file, $configuration) {
 
// get the path to the file to operate on.
 
$filepath = media_mover_api_config_current_file($file);
 
 
// open connection to encoding.com
 
  // transfer file
 
  // tell encoding.com what to do with it
 
  // get the new file path back from encoding.com
 
 
return $filepath;
}
?>

#3

godewebog - September 21, 2009 - 12:26

Thank you for the code! It is a good start point to implement encoding.com plugin for media_mover. I am working on such module. However it may take time because I have not a big expirience with encoding.com api and media_mover api. I will share this as soon as it is ready. So any help in it will be apprecated (may be somebody has implemented the task already?)

#4

arthurf - September 21, 2009 - 13:03

I'm happy to help with the MM side. I'll also port the module to the 2.0 version of MM once that code gets more stable. The API for 2.0 is better, but there are no real changes for the module developer side.

#5

denisanokhin - October 15, 2009 - 11:06

@godewebug. Any news on the encoding.com integration module? Could you please share the module?

 
 

Drupal is a registered trademark of Dries Buytaert.