Recherche avancée

Médias (0)

Mot : - Tags -/formulaire

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (44)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (6650)

  • Rails using stremio-ffmpeg gem to watermark a movie while uploading

    16 juin 2016, par Felix

    I am using carrierwave to upload a movie to amazon s3 that works perfect.

    Now I want to add a watermark to the movie while uploading or after uploading, I don’t know, what’s the best way ?

    I tried this :

    movie_controller.rb action uploadVideo

    movie = FFMPEG::Movie.new(@vid.video.url)

    puts "........................................"
    puts movie.inspect

    if @vid.save

    Just to find out if the video is catched from stremio.

    But then I got the error that the movie is not found, the problem is that it doesn’t look in the amazon s3 bucket, it looks on my local server

    No such file or directory - the file '/uploads/tmp/1462954331-3471-8766/VID-20160424-WA0013.mp4' does not exist

    What could be the solution ? or should I do this in carrierwave uploader ?

    UPDATE :

    When I do this after the .save action it looks at amazon s3 bucket .. but also says that the movie isn’t there. But if I call it directly in browser it’s displayed.

    UPDATE Code :

    #Laedt ein Video hoch
    def uploadMovie
     @user = User.find_by_id session[:user_id]
     #Holt alle Channels für die er eine Berechtigung hat (Eingeloggter user)
     @user = User.find_by_id session[:user_id]
     @knowledgeproviderList = @user.knowledgeprovider
     @channels = Channel.where(knowledgeprovider_id:     @knowledgeproviderList.pluck(:id))
     @vid = Movie.new(movies_params)
     @channel = Channel.find(params[:vid][:channel_id])
     @vid.channel = @channel

     #Fügt dem Movie einen Tag hinzu
     createTag params
     createCategory params



     if @vid.save
       flash[:notice] = t("flash.saved")

       #movie = FFMPEG::Movie.new(@vid.video.url)

       #puts "........................................"
       #puts movie.inspect

       redirect_to :action => :add
      else
        redirect_to :action => :add
     end
    end

    Update error :

    movie = FFMPEG::Movie.new(@vid.video.current_path)

    options = {watermark: "mages/header.png", resolution: "640x360", watermark_filter: { position: "RT", padding_x: 10, padding_y: 10 } }
    movie.transcode("movie.flv", options)

    enter image description here

    Update :
    Added the code in the uploader :

     process :watermark_movie

        def watermark_movie
          if self.file.path
                options = {watermark: "images/header.png", resolution: "640x360", watermark_filter: { position: "RT", padding_x: 10, padding_y: 10 } }
                self.model.file = FFMPEG::Movie.new(self.file.path).transcode("#{root}/#{cache_dir}/#{self.cache_id}/file.mp4", options)
           end
         end

    Error :

    multi_json (1.12.0) lib/multi_json/adapter.rb:19:in `load'
    multi_json (1.12.0) lib/multi_json.rb:122:in `load'
    streamio-ffmpeg (2.0.0) lib/ffmpeg/movie.rb:28:in `initialize'
    app/uploaders/movie_uploader.rb:40:in `new'
    app/uploaders/movie_uploader.rb:40:in `watermark_movie'
    carrierwave (0.11.2) lib/carrierwave/uploader/processing.rb:84:in `block in process!'
    carrierwave (0.11.2) lib/carrierwave/uploader/processing.rb:76:in `each'
    carrierwave (0.11.2) lib/carrierwave/uploader/processing.rb:76:in `process!'
    carrierwave_backgrounder (0.4.2) lib/backgrounder/delay.rb:14:in `process!'
    carrierwave (0.11.2) lib/carrierwave/uploader/callbacks.rb:18:in `block in with_callbacks'
    carrierwave (0.11.2) lib/carrierwave/uploader/callbacks.rb:18:in `each'
    carrierwave (0.11.2) lib/carrierwave/uploader/callbacks.rb:18:in `with_callbacks'
    carrierwave (0.11.2) lib/carrierwave/uploader/cache.rb:134:in `cache!'
    carrierwave (0.11.2) lib/carrierwave/mount.rb:329:in `cache'
    carrierwave (0.11.2) lib/carrierwave/mount.rb:163:in `video='
    carrierwave (0.11.2) lib/carrierwave/orm/activerecord.rb:39:in `video='
    activerecord (4.2.1) lib/active_record/attribute_assignment.rb:54:in `public_send'
    activerecord (4.2.1) lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
    activerecord (4.2.1) lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
    actionpack (4.2.1) lib/action_controller/metal/strong_parameters.rb:183:in `each_pair'
    actionpack (4.2.1) lib/action_controller/metal/strong_parameters.rb:183:in `each_pair'
    activerecord (4.2.1) lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
    activerecord (4.2.1) lib/active_record/core.rb:559:in `init_attributes'
    activerecord (4.2.1) lib/active_record/core.rb:281:in `initialize'
    activerecord (4.2.1) lib/active_record/inheritance.rb:61:in `new'
    activerecord (4.2.1) lib/active_record/inheritance.rb:61:in `new'
    app/controllers/movies_controller.rb:71:in `uploadMovie'
    actionpack (4.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
    actionpack (4.2.1) lib/abstract_controller/base.rb:198:in `process_action'
    actionpack (4.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
    actionpack (4.2.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
    activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
    activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
    activesupport (4.2.1) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
    activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
    activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
    activesupport (4.2.1) lib/active_support/callbacks.rb:92:in `_run_callbacks'
    activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
    activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
    actionpack (4.2.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
    actionpack (4.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
    actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
    activesupport (4.2.1) lib/active_support/notifications.rb:164:in `block in instrument'
    activesupport (4.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    activesupport (4.2.1) lib/active_support/notifications.rb:164:in `instrument'
    actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
    actionpack (4.2.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
    activerecord (4.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
    actionpack (4.2.1) lib/abstract_controller/base.rb:137:in `process'
    actionview (4.2.1) lib/action_view/rendering.rb:30:in `process'
    actionpack (4.2.1) lib/action_controller/metal.rb:196:in `dispatch'
    actionpack (4.2.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
    actionpack (4.2.1) lib/action_controller/metal.rb:237:in `block in action'
    actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `call'
    actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
    actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:43:in `serve'
    actionpack (4.2.1) lib/action_dispatch/journey/router.rb:43:in `block in serve'
    actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `each'
    actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `serve'
    actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:819:in `call'
    rack (1.6.4) lib/rack/etag.rb:24:in `call'
    rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
    rack (1.6.4) lib/rack/head.rb:13:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/flash.rb:260:in `call'
    rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
    rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
    activerecord (4.2.1) lib/active_record/query_cache.rb:36:in `call'
    activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
    activerecord (4.2.1) lib/active_record/migration.rb:378:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
    activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call'
    activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks'
    activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
    activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
    actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
    web-console (2.3.0) lib/web_console/middleware.rb:20:in `block in call'
    web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
    web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
    railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
    railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
    activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
    activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
    activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
    railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
    rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
    rack (1.6.4) lib/rack/runtime.rb:18:in `call'
    activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
    rack (1.6.4) lib/rack/lock.rb:17:in `call'
    actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
    rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
    railties (4.2.1) lib/rails/engine.rb:518:in `call'
    railties (4.2.1) lib/rails/application.rb:164:in `call'
    rack (1.6.4) lib/rack/lock.rb:17:in `call'
    rack (1.6.4) lib/rack/content_length.rb:15:in `call'
    rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
    /home/felix/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
    /home/felix/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
    /home/felix/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

    UPDATE — Movie Uploader

    # encoding: utf-8
    class MovieUploader < CarrierWave::Uploader::Base

     # Include RMagick or MiniMagick support:
     # include CarrierWave::RMagick
     include CarrierWave::MiniMagick
     include CarrierWave::Video
     include CarrierWave::Video::Thumbnailer
     include CarrierWave::Backgrounder::Delay

     require 'rubygems'
     require 'streamio-ffmpeg'

     # Choose what kind of storage to use for this uploader:
     storage :fog

     # Override the directory where uploaded files will be stored.
     # This is a sensible default for uploaders that are meant to be mounted:
     def store_dir
       "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
     end

     process :watermark_movie

     def watermark_movie
       puts "ssssssssssssssssssssssssssssssssss"
       puts self.file.inspect

       if self.file.path
         options = {watermark: "http://felix-hohlwegler.de/holz-soft/include/designs/design13/images/header.png", resolution: "640x360", watermark_filter: { position: "RT", padding_x: 10, padding_y: 10 } }
         self.model.file = FFMPEG::Movie.new(self.file.path).transcode("#{root}/#{cache_dir}/#{self.cache_id}/file.mp4", options)
       end
     end

     version :thumb do
       process thumbnail: [{format: 'png', quality: 10, size: 1200, strip: false, seek: 10, logger: Rails.logger}]
       def full_filename for_file
         png_name for_file, version_name
       end
     end

     def png_name for_file, version_name
       %Q{#{version_name}_#{for_file.chomp(File.extname(for_file))}.png}
     end


     # Add a white list of extensions which are allowed to be uploaded.
     # For images you might use something like this:
      def extension_white_list
        %w(mov avi mkv mpeg mpeg2 mp4 3gp)
      end
    end
  • use java-ffmpeg wrapper, or simply use java runtime to execute ffmpeg ?

    12 mars 2017, par user156153

    I’m pretty new to Java, need to write a program that listen to video conversion instructions and convert the video once an new instruction arrives (instructions is stored in Amazon SQS, but it’s irrelevant to my question)

    I’m facing a choice, either use Java RunTime to exec ’ffmpeg’ conversion (like from command line), or I can use a ffmpeg wrapper written inJava http://fmj-sf.net/ffmpeg-java/getting_started.php

    I’d much prefer using Java Runtime to exec ffmpeg directly, and avoid using java-ffmpeg wrapper as I have to learn the library. so my question is are there any benefits using java-ffmpeg wrapper over exec ffmpeg directly using Runtime ? I don’t need ffmpeg to play videos, just convert videos

    Thanks

  • Issues with processing media on windows Azure

    23 septembre 2015, par Ahmed Mujtaba

    I have a website built on ASP.NET web forms that works as a media portal for users to upload videos. I’m using ffmpeg encoders to produce video contents to be streamed in the browser. I’m using the web deploy method to publish the site on the Azure server. The website get’s deployed properly however I get following issues in the live site.

    1. Video never get’s encoded and published. I get some sort of error.

    2. Video get’s published but the process of uploading and encoding the video is way too slow on the web server.

    My project solution contains upload.ashx that handles the upload requests and makes the call to encode.ashx which is responsible for the encoding and publishing of the videos. I tried to remotely debug the site but the debugger never get’s to encode.ashx.

    I was wondering if these issues can be resolved by having the website deployed with a VM ?

    Script that uploads the video file :

    var filesuploaded = 0;
       var faileduploaded = 0;

       $(function () {
           var uploader = new plupload.Uploader({
               runtimes: 'gears,html5,flash,silverlight,browserplus',
               browse_button: '<%= pickfiles.ClientID %>',
               container: 'container',
               max_file_size: '<%= MaxMediaSize %>mb',
               url: '<%=Config.GetUrl() %>videos/upload/upload.ashx',
               flash_swf_url: '<%=Config.GetUrl() %>plupload/js/plupload.flash.swf',
               silverlight_xap_url: '<%=Config.GetUrl() %>plupload/js/plupload.silverlight.xap',
               chunk_size: '4mb',
               <%= UniqueNames %>
               filters: [
               { title: '<%= AllowedFormatsDisplay %>', extensions: '<%= AllowedFormats %>'}],
               headers: { UName: '<%=UserName %>', MTP: '<%= MediaType %>' }
           });
           //uploader.bind('Init', function (up, params) {
           //    $('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
           //});

           uploader.init();

           $('#uploadfiles').click(function (e) {
               uploader.start();
               e.preventDefault();
               $("#uploadfiles").hide();
               $("#&lt;%= embd.ClientID %>").hide();
           });

           uploader.bind('FilesAdded', function (up, files) {
               $("#uploadfiles").show();
               $("#&lt;%= msg.ClientID %>").html("");
               var count=0;
               $.each(files, function (i, file) {
                   $('#filelist').append(
                       '<div class="item_pad_4 bx_br_bt">' + (count + 1) + ': ' + file.name + ' (' + plupload.formatSize(file.size) + ')  <b></b></div>' );
                   count++;
               });
               var maxupload = &lt;%= MaxVideoUploads %>;
               if(count > maxupload)
               {              
                   $.each(files, function(i, file) {
                       uploader.removeFile(file);
                   });

                   $('#filelist').html("");
                   $("#uploadfiles").hide();
                   Display_Message("#&lt;%= msg.ClientID %>", "Can't upload more than " + maxupload + " records at once!", 1, 1);
                   return false;
               }
               else {
                   $("#tfiles").html(count);
                   $("#uploadfiles").removeClass("disabled");
                   $("#&lt;%= pickfiles.ClientID %>").hide();
               }
               up.refresh(); // Reposition Flash/Silverlight
           });

           uploader.bind('UploadProgress', function (up, file) {
               $('#' + file.id + " b").html(file.percent + "%");
           });

           uploader.bind('Error', function (up, err) {
               $('#filelist').append("<div>Error: " + err.code +
                   ", Message: " + err.message +
                   (err.file ? ", File: " + err.file.name : "") +
                   "</div>"
               );
               up.refresh(); // Reposition Flash/Silverlight
           });

           var failedstatus = 0;
           uploader.bind('FileUploaded', function (up, file, info) {
               // encode started
               if (info.response != "failed" &amp;&amp; info.response != "") {
                   EncodeVD(file.id, info.response, file.size);
                   Display_Message('#' + file.id, "Please wait for final processing", 0, 1);
                   if (failedstatus == 0)
                       Redirect(info.response);
                   filesuploaded++;
               }
               else {
                   Display_Message('#' + file.id, "Response is: " + info.response, 0, 1);
               }
           });
       });
       var redcnt = 0;
       function Redirect(filename) {
           var IntervalID = setInterval(function () {
               redcnt++;
               if (redcnt > 2) {
                   clearInterval(IntervalID);
                   var tfiles = $("#tfiles").html();
                   if(tfiles == faileduploaded) { // break further processing all videos failed to upload
                   }
                   else if (filesuploaded >= tfiles) {
                       document.location = "&lt;%=ConfirmPageUrl %>?fn=" + filename + "&amp;gid=&lt;%=GalleryID %>&amp;uvids=" + $("#tfiles").html() + "&amp;mpid=" + $("#maxpid").html().trim() + "&lt;%=GroupParam %>";
                   }
           }
           }, 2000);
    }
    function EncodeVD(mid, mfile, msize) {
       var params = '&lt;%= EncodingParams %>&amp;fn=' + mfile;
           $.ajax({
               type: 'GET',
               url: '&lt;%= Encoding_Handler_Path %>',
               data: params,
               async: true,
               success: function (msg) {
                   if (msg == "Success" || msg == "") {
                       $('#' + mid).html('<strong>Uploading Completed Successfully - Wait for Processing.');
                   }
                   else {
                       failedstatus = 1;
                       faileduploaded++;
                       Display_Message('#' + mid, "Response is: " + msg, 0, 1);
                   }
               }
           });
       }
    </strong>

    Server side code for processing the file upload :

    private int MediaType = 0; // 0 : video, 1: audio

       public void ProcessRequest (HttpContext context) {
           try
           {
               context.Response.ContentType = "text/plain";
               context.Response.Write(ProcessMedia(context));
           }
           catch (Exception ex)
           {
               context.Response.Write("error|" + ex.Message);
           }
       }

       public string ProcessMedia(HttpContext context)
       {
           if (context.Request.Files.Count > 0)
           {
               int chunk = context.Request["chunk"] != null ? int.Parse(context.Request["chunk"]) : 0;
               string fileName = context.Request["name"] != null ? context.Request["name"] : string.Empty;
               //string _fileName = fileName.Remove(fileName.LastIndexOf(".")) + "-" + Guid.NewGuid().ToString().Substring(0, 6) + "" + fileName.Remove(0, fileName.LastIndexOf("."));
               HttpPostedFile fileUpload = context.Request.Files[0];

               string upath = "";
               if (context.Request.Headers["UName"] != null)
                   upath = context.Request.Headers["UName"].ToString();

               //if (CloudSettings.EnableCloudStorage &amp;&amp; upath != "")
               //    _fileName = upath.Substring(0, 3) + "-" + _fileName; // avoid duplication in cloud storage

               if (context.Request.Headers["MTP"] != null)
                   MediaType = Convert.ToInt32(context.Request.Headers["MTP"]);

               //string extensions = "";
               //if (MediaType == 0)
               //    extensions = Site_Settings.Video_Allowed_Formats;
               //else
               //    extensions = Site_Settings.Audio_Allowed_Formats;

               //bool sts = UtilityBLL.Check_File_Extension(extensions, fileName.ToLower());
               //if (sts == false)
               //{
               //    return "Invalid format, please upload proper video!"; // Invalid video format, please upload proper video
               //}

               int allowable_size_mb = 0;
               if (MediaType == 0)
               {
                   allowable_size_mb = Site_Settings.Video_Max_Size;
               }
               else
               {
                   allowable_size_mb = Site_Settings.Audio_Max_Size;
               }
               int UploadSize = allowable_size_mb * 1000000;
               if (fileUpload.ContentLength > UploadSize)
               {
                   return "Video Limit Exceeds";
               }

               string uploadPath = "";
               // check whether audio / mp3 encoding enabled
               if (this.MediaType == 1)
               {
                   // audio encoding
                   if (fileName.EndsWith(".mp3"))
                   {
                       // upload mp3 directly in mp3 path instead of default path
                       if (upath == "")
                           uploadPath = UrlConfig.MP3_Path(); // source video path
                       else
                           uploadPath = UrlConfig.MP3_Path(upath); // source video path
                   }
                   else
                   {
                       // default path
                       if (upath == "")
                           uploadPath = UrlConfig.Source_Video_Path(); // source video path
                       else
                           uploadPath = UrlConfig.Source_Video_Path(upath); // source video path
                   }
               }
               else
               {//azure
                   // default path
                   if (upath == "")
                       uploadPath = UrlConfig.Source_Video_Path(); // source video path
                   else
                       uploadPath = UrlConfig.Source_Video_Path(upath); // source video path
               }

               FileStream fs;
               using (fs = new FileStream(Path.Combine(uploadPath, fileName), chunk == 0 ? FileMode.Create : FileMode.Append))
               {
                   byte[] buffer = new byte[fileUpload.InputStream.Length];
                   fileUpload.InputStream.Read(buffer, 0, buffer.Length);

                   fs.Write(buffer, 0, buffer.Length);
               }
               return fileName; // "Success";
           }
           else
           {
               return "failed";
           }

           return "";
       }
       public bool IsReusable {
           get {
               return false;
           }
       }

    code in encode.aspx responsible for encoding the video :

    private string EncodeMedia(HttpContext context)
    {
       string sourcepath = "";
       string publishedpath = "";
       string mp3path = "";
       string thumbpath = "";
       if (this.UserName != "")
       {//azure
           sourcepath = UrlConfig.Source_Video_Path(this.UserName);
           publishedpath = UrlConfig.Published_Video_Path(this.UserName);
           mp3path = UrlConfig.MP3_Path(this.UserName);
           thumbpath = UrlConfig.Thumbs_Path(this.UserName);
       }
       else
       {
           sourcepath = UrlConfig.Source_Video_Path();
           publishedpath = UrlConfig.Published_Video_Path();
           mp3path = UrlConfig.MP3_Path();
           thumbpath = UrlConfig.Thumbs_Path();
       }
       if (this.FileName.EndsWith(".mp3") &amp;&amp; this.MediaType == 1)
       {
           // mp3 and audio format
           if (!File.Exists(mp3path + "/" + this.FileName))
           {
               return "Audio file not found!";
           }
       }
       else
       {
           // rest normal video and audio encoding
           if (!File.Exists(sourcepath + "/" + this.FileName))
           {
               return "Source file not found!";
           }
       }

       if (CloudSettings.EnableCloudStorage &amp;&amp; this.UserName != "")
           this.FileName = this.UserName.Substring(0, 3) + "-" + this.FileName; // avoid duplication in cloud storage


       //double f_contentlength = 0;
       //if (Site_Settings.Feature_Packages == 1)
       //{
       //    if (Config.GetMembershipAccountUpgradeType() != 1)
       //    {
       //        // Check whether user have enough space to upload content
       //        // Restriction only for normal or premium users
       //        f_contentlength = (double)fileUpload.ContentLength / 1000000;
       //        string media_field_name = "space_video";
       //        if (MediaType == 1)
       //            media_field_name = "space_audio";
       //        if (!User_PackagesBLL.Check_User_Space_Status(upath, media_field_name, f_contentlength) &amp;&amp; !isAdmin)
       //        {
       //            // insufficient credits to upload content
       //            return "Insufficient credits to upload media file"; //   Response.Redirect(Config.GetUrl("myaccount/packages.aspx?status=" + media_field_name), true);
       //        }
       //    }
       //}

       this.backgroundpublishing = true; // should be true on direct encoding
       // Video Processing
       string flv_filename = "";
       string original_filename = "";
       string thumb_filename = "";
       string duration = "";
       int duration_sec = 0;

       // set video actions : 1 -> on, 0 -> off
       int isenabled = 1;
       int ispublished = 1;
       int isreviewed = 1;
       int isresponse = 0;
       if (Response_VideoID > 0)
           isresponse = 1;

       string flv_url = "none";
       string thumb_url = "none";
       string org_url = "none";
       string _embed = "";

       string errorcode = "0";
       VideoInfo info = null;

       if (Site_Settings.Content_Approval == 0)
           isreviewed = 0;


       // check whether audio / mp3 encoding enabled
       if (this.FileName.EndsWith(".mp3") &amp;&amp; this.MediaType==1)
       {
           // audio encoding
           // mp3 file already
           // so no encoding happens
           MediaHandler _minfo = new MediaHandler();
           _minfo.FFMPEGPath = Encoding_Settings.FFMPEGPATH;
           _minfo.FileName = FileName;
           _minfo.InputPath = mp3path;
           info = _minfo.Get_Info();

           flv_filename = FileName;
           original_filename = FileName;
           duration = info.Duration;
           duration_sec = info.Duration_Sec;
           isenabled = 1; // enabled
       }
       else if (this.directpublishing)
       {            

           // publish video
           ArrayList itags = new ArrayList();
           MHPEncoder encoder = new MHPEncoder();
           //if (this.FileName.EndsWith(".mpeg") || this.FileName.EndsWith(".mpg")) // use mpg compatible ffmpeg encoder
           //    encoder.FfmpegPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + "\\ffmpeg\\ffmpegbk\\ffmpeg.exe";
               //encoder.ThumbFfmpegPath = Encoding_Settings.FFMPEGPATH; // use normal ffmpeg encoder for thumbs processing

           //azure
           encoder.FfmpegPath = Encoding_Settings.FFMPEGPATH; // use normal ffmpeg encoder
           encoder.FlvToolPath = Encoding_Settings.FLVTOOLPATH; // set meta information for flv videos
           encoder.Mp4BoxPath = Encoding_Settings.MP4BoxPath; // set meta information for mp4 videos
           encoder.SourcePath = sourcepath;
           encoder.SourceFileName = this.FileName;

           // No cloud storage on direct encoding
           //if (CloudSettings.EnableCloudStorage)
           //    encoder.EnableCloudStorage = true;


           if (MediaType == 1)
           {
               // audio encoding
               itags.Add("14");
               encoder.iTags = itags;
               encoder.GrabThumbs = false;
               encoder.PublishedPath = mp3path;

               //_vprocess.OutputPath = this.MP3Path;
               //_vprocess.isAudio = true;
           }
           else
           {
               // video encoding
               itags.Add(EncoderSettings.DefaultITagValue.ToString()); // 5 for 360p mp4 encoding    
               //itags.Add(7);   // this will call 7 case settings to publish next video ending with _7.mp4 instead of _5.mp4
               // so there will be 2 videos with different resoultions published at the end of the process?
               // yesmake sure use proper settings first test it directly via command.    
               //okay i got it. But i'm gonna have to use a different media players to incroporate those settings
               // once published you can load different videos for different user by checking _7.mp4 (end) va
              //okay got it.

               //azure
               encoder.PublishedPath = publishedpath;
               encoder.iTags = itags;
               encoder.ThumbsDirectory = thumbpath;
               encoder.TotalThumbs = 15;

               //_vprocess.ThumbPath = this.ThumbPath;
               //_vprocess.OutputPath = this.FLVPath;
               //if (Config.isPostWaterMark())
               //{
               //    // script for posting watermark on video
               //    _vprocess.WaterMarkPath = Server.MapPath(Request.ApplicationPath) + "\\contents\\watermark";
               //    _vprocess.WaterMarkImage = "watermark.gif";

               //}
           }
           int deleteoption = Site_Settings.Video_Delete_Original;
           if (deleteoption == 1)
           {
               encoder.DeleteSource = true;
           }
           // background processing
           if (this.backgroundpublishing &amp;&amp; this.MediaType==0)
           {
               encoder.BackgroundProcessing = true;
               // get information from source video in order to store it in database
               MediaHandler _minfo = new MediaHandler();
               //if (this.FileName.EndsWith(".mpeg") || this.FileName.EndsWith(".mpg")) // use mpg compatible ffmpeg encoder
               //    encoder.FfmpegPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + "\\ffmpeg\\ffmpegbk\\ffmpeg.exe";
               //else
                   _minfo.FFMPEGPath = Encoding_Settings.FFMPEGPATH;

               _minfo.FileName = FileName;
               _minfo.InputPath = sourcepath;
               info = _minfo.Get_Info();
           }
           // encode video processing
           Video_Information vinfo = encoder.Process();
           if (vinfo.ErrorCode > 0)
           {
               errorcode = vinfo.ErrorCode.ToString();
               ErrorLgBLL.Add_Log("Encoding Failed Log", "", "encoding error: " + vinfo.ErrorCode.ToString() + "<br />Description: " + vinfo.ErrorDescription.ToString());
                //return vinfo.ErrorDescription;
           }
           // Double check validation
           // if published video exist
           // if thumb exist
           // then proceed further

           if (MediaType == 0)
           {
               if (!File.Exists(encoder.PublishedPath + "/" + vinfo.FLVVideoName))
               {
                   return "Video failed to published properly.";
               }
               if (!File.Exists(encoder.ThumbsDirectory + "/" + vinfo.ThumbFileName))
               {
                   return "Thumbs failed to grab from video properly.";
               }
           }
           else
           {
               if (vinfo.FLVVideoName == "")
               {
                   vinfo.FLVVideoName = this.FileName.Remove(this.FileName.LastIndexOf(".")) + "_14.mp3"; // mp3 file path name
               }
               if (!File.Exists(encoder.PublishedPath + "/" + vinfo.FLVVideoName))
               {
                   return "Audio failed to published properly.";
               }
           }
           // Now thumbs and video published, procceed for data processing
           // get information from vinfo object
           if (this.backgroundpublishing &amp;&amp; this.MediaType == 0)
           {
               string OutputFileName = this.FileName.Remove(this.FileName.LastIndexOf("."));
               flv_filename = OutputFileName + "_" + EncoderSettings.DefaultITagValue + "." + EncoderSettings.Return_Output_Extension(EncoderSettings.DefaultITagValue);
               original_filename = vinfo.OriginalVideoName;
               thumb_filename = OutputFileName + "_008.jpg"; // info.ThumbFileName;
               duration = info.Duration;
               duration_sec = info.Duration_Sec;
           }
           else
           {
               flv_filename = vinfo.FLVVideoName;
               original_filename = vinfo.OriginalVideoName;
               thumb_filename = vinfo.ThumbFileName;
               duration = vinfo.Duration;
               duration_sec = vinfo.Duration_Sec;
               isenabled = vinfo.isEnabled;
           }

           // No cloud storage on direct encoding.
           // Note cloude storage only works if background processing is disabled
           // Or works in cased of sheduled processing
           if (CloudSettings.EnableCloudStorage &amp;&amp; errorcode == "0")
           {
               flv_url = "amazon";
               org_url = "https://s3.amazonaws.com/" + CloudSettings.OriginalVideoBucketName + "/" + this.FileName;
               thumb_url = "https://s3.amazonaws.com/" + CloudSettings.ThumbsBucketName + "/" + thumb_filename;

           }

       }
       else
       {
           // set publishing status off.
           ispublished = 0;
           original_filename = this.FileName;
       }

       // Store video information in database
       string ipaddress = context.Request.ServerVariables["REMOTE_ADDR"].ToString();

       // Store media information in database
       Video_Struct vd = new Video_Struct();
       vd.CategoryID = 0; // store categoryname or term instead of category id
       vd.Categories = Categories;
       vd.UserName = UserName;
       vd.Title = "";
       vd.Description = "";
       vd.Tags = Tags;
       vd.Duration = duration;
       vd.Duration_Sec = duration_sec;
       vd.OriginalVideoFileName = original_filename;
       vd.VideoFileName = flv_filename;
       vd.ThumbFileName = thumb_filename;
       vd.isPrivate = Privacy;
       vd.AuthKey = PAuth;
       vd.isEnabled = isenabled;
       vd.Response_VideoID = Response_VideoID; // video responses
       vd.isResponse = isresponse;
       vd.isPublished = ispublished;
       vd.isReviewed = isreviewed;
       vd.FLV_Url = flv_url;
       vd.Thumb_Url = thumb_url;
       vd.Org_Url = org_url;
       vd.Embed_Script = _embed;
       vd.isExternal = 0; // website own video, 1: embed video
       vd.IPAddress = ipaddress;
       vd.Type = MediaType;
       vd.YoutubeID = "";
       vd.isTagsreViewed = 1;
       vd.Mode = 0; // filter videos based on website sections
       //vd.ContentLength = f_contentlength;
       vd.GalleryID = GID;
       vd.ErrorCode = Convert.ToInt32(errorcode);
       long videoid = VideoBLL.Process_Info(vd, false);

       // Process tags
       if (Tags != "")
       {
           int tag_type = 0; // represent videos
           if (MediaType == 1)
               tag_type = 4; // represent audio file
           TagsBLL.Process_Tags(Tags, tag_type, 0);
       }

       if (Response_VideoID > 0)
       {
           VideoBLL.Update_Responses(Response_VideoID);
       }

       return "Success";
    }