Media Handler Pro Free Version Extended.

  • 19 April 2013

Today we announced the release of extended version of asp.net media handler pro component free version. Now free version have almost all features and have no feature restrictions. You can freely use it in your unlimited no of applications, servers and domains.

You can download it from http://download.cnet.com/NET-Media-Handler-Pro/3000-10250_4-10875307.html

Difference Between Free Version and Full Version of Media Handler Pro.

There is only one different between pro and free version as pro version can support background video and audio processing which will prevent any deadlock in your application while encoding large media files.

For more detail about pro version visit.

http://www.mediasoftpro.com/media-handler-pro/pro.html

iPhone HTTP Streaming using ASP.NET, C# and VB.NET

  • 02 February 2012

With iPhone OS 3 update came the ability to do live streaming. There are a few types of streaming and each requires a certain encoding and segmentation. In this example i am building stream using asp.net media handler pro, open source ffmpeg and segmenter utility.

Requirements

i: asp.net media handler pro

ii: open source ffmpeg utility

iii: segmenter

Steps

Publish video to iphone device

Supported Settings For Iphone

The supported bitrates for streaming are: 100 Kbps to 1.6 Mbps

The suggested bitrates for streaming are*: Low – 96 Kbps video, 64 Kbps audio

Medium – 256 Kbps video, 64 Kbps audio

High – 800 Kbps video, 64 Kbps audio

The iPhone screen size is: 480×320

Suggested ffmpeg command for encoding iphone video

ffmpeg -i <in file> -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320×240 -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 <output file>

 

Segment Video For Http Streaming

Now you have a complete video but you don't want to toss the entire thing up or you wouldn't be reading about HTTP streaming. What you need is a way to segment the video stream into smaller chunks. You can download Apple's segmenter 

Publishing Iphone .TS Video and Making Playlist Segment via ASP.NET Media Handler Pro

Below sample code will help you to publish .ts (video/MP2T) video and create .m3u8 (application/x-mpegURL) segments via segmenter tool.

MediaHandler media = new MediaHandler();

string RootPath = Server.MapPath(Request.ApplicationPath);

media.FFMPEGPath = RootPath + "\\\\ffmpeg\\\\ffmpeg.exe";

media.InputPath = RootPath + "\\\\contents\\\\hls";

media.OutputPath = RootPath + "\\\\contents\\\\hls";

media.FileName = "a.wmv";

media.OutputFileName = "a";

media.OutputExtension = ".ts";

media.Parameters = "-f mpegts -acodec libmp3lame -ar 48000 -ab 64k -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 -s 320x240";

VideoInfo info = media.Process();

if (info.ErrorCode > 0)

{

    Response.Write("Error Occured: " + info.ErrorCode);

    return;

}

media.ServicePath = RootPath + "\\\\segmenter\\\\segmenter.exe";

string ts_filename = "\\"" + media.OutputPath + "\\\\a.ts\\"";

string m3u8_filename = "\\"" + media.OutputPath + "\\\\stream.m3u8\\"";

string prefix = "\\"" + media.OutputPath + "\\\\stream\\"";

media.Parameters = ts_filename + " 10 " + prefix + " " + m3u8_filename + " http://www.example.com/";

string output = media.ProcessCMD();

Response.Write(output);

This code will generate output .ts video with .m3u8 and segment playlist.

Add Mimetype

In order to stream .ts and .m3u8 format files properly you must add the following two mimetypes

.m3u8 application/x-mpegURL

.ts video/MP2T

 

Test Streaming

The video is encoded for the iPhone, segmented for streaming, and the server is configured. The only thing left to do is test the stream and the fastest way to do that is to use the new HTML5 video tag.

<video width='150' height='150' src="stream-128k.m3u8" />

HTTP Pseudo-Streaming in ASP.NET Video Starter Kit

  • 27 March 2011

Both MP4 and FLV videos can be played back with a mechanism called HTTP \r\nPseudostreaming. This mechanism allows your viewers to seek to not-yet \r\ndownloaded parts of a video. YouTube is an example site that offers this\r\n functionality.

Previously we implement HTTP Pseudostreaming concept based on server \r\nside scripting. Such a script have lots of disadvantages such a script \r\nconsumes a lot of resources, has security implications and can only be \r\nused with FLV files mostly.

Now we encourage user to implement proper HTTP Pseudostreaming through \r\ntheir webserver rather than using any script. HTTP Pseudostreaming does \r\nnot work by default on any webserver. A serverside module is needed to \r\nenable it.

The most popular module is H264 Streaming Module which allow user  to \r\nimplement Http Pseudo streaming for mp4 videos through IIS web server.
How to Setup?

IIS 6 Instructions
IIS 7 Instructions

Once module is enabled, it will stream mp4 videos properly through JW \r\nPlayer as already implemented in ASP.NET Video Starter Kit.

MP4 Encoding & Setting Meta Information via Media Handler Pro

  • 25 October 2010

Here we provide sample code that can help u to use Media Handler Pro component in your asp.net application (c#, vb.net) to

i: Publish any format video to high quality mp4 format using libx264 codec and preset files
ii: Set meta information to mp4 video in order to stream properly on web.

We recommend you to download latest ffmpeg build with presets support from http://ffmpeg.arrozcru.org/autobuilds/

i: Sample Code for MP4 Video using libx264 codec and preset files

private string PresetFilePath = // path of preset file u are doing to use for mp4 encoding. preset files located withing ffmpeg/preset/ folder.
_mhandler.OutputExtension = ".mp4";
_mhandler.OutputFileName = "sample_temp";
_mhandler.VCodec = "libx264";
_mhandler.Parameters = " -bt 240k -fpre " + this.PresetFilePath + "";
_mhandler.Video_Bitrate = 200;
_mhandler.Channel = 2;
_mhandler.Audio_SamplingRate = 48000;
_mhandler.Audio_Bitrate = 192;
_mhandler.FrameRate = 29.97;
info = _mhandler.Process();

The code above will create mp4 video with name 'sample_temp.mp4', In order to stream this video on web you need to add meta information otherwise players will first download complete video and will then play it.
For adding meta information we are using mp4box with Media Handler Pro. U can use the following code to set meta information and make streamable mp4 video from 'sample_temp.mp4' video via mp4box utility.

string MP4BoxPath = // path to mp4box utility in similar way as ffmpeg or preset file path.
_mhandler.MP4BoxPath = MP4BoxPath;
string  _mp4_temp_path = // complete path of output sample_temp.mp4 video
_mhandler.Parameters = "-isma -hint -add " + _mp4_temp_path + "";
_mhandler.FileName = sample_temp.mp4.Replace("_temp.mp4",".mp4"); // replace temp.mp4 with normal mp4 video, remove temp video after creating streamable mp4 video. e.g (sample.mp4)
_mhandler.InputPath = this.OutputPath;
_mhandler.Set_MP4_Buffering();

Set_MP4_Buffering() will create streamable mp4 video (sample.mp4) from (sample_temp.mp4) video.


After creation you can delete sample_temp.mp4 video.

ASP.NET - FLV, MP4, Vorbis, VP8 WebM, PNG encoding in one step using Media Handler Pro

  • 24 July 2010

You can use the following sample code to publish any format video to flash flv, mp4, vp8 webm, ogg vorbis, grab thumb in one step using ASP.NET Media Handler Pro.

Note: You need to download latest ffmpeg build with support of VP8 codec

Sample Code:

_mhandler.InputPath = RootPath + "\\\\contents\\\\original";
_mhandler.OutputPath = RootPath + "\\\\contents\\\\output";
VideoInfo info = new VideoInfo();
_mhandler.FileName = "sample.wmv";
_mhandler.OutputFileName = "sample";
//***************************************
//FLV Encoding
//***************************************

_mhandler.OutputExtension = ".flv";
_mhandler.Video_Bitrate = 500;
_mhandler.Audio_Bitrate = 128;
_mhandler.Audio_SamplingRate = 44100;
_mhandler.Force = "flv";
info = _mhandler.Process();
if (info.ErrorCode > 0)
{
       Response.Write("Error occured while processing flv video");
       return;
}
_mhandler.Force = "";
//******************************************
// MP4 Encoding - HQ - 1 Pass
//******************************************

_mhandler.OutputExtension = ".mp4";
_mhandler.FrameRate = 23.97;
_mhandler.Video_Bitrate= 6144;
_mhandler.VCodec = "libx264";
_mhandler.Parameters = "-bt 8192k -coder 1 -flags +loop -cmp +chroma -partitions -parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -me_method dia -subq 2 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 3 -refs 1 -directpred 3 -trellis 0 -flags2 -bpyramid-wpred-mixed_refs-dct8x8+fastpskip -wpredp 2";
info = _mhandler.Process();
if (info.ErrorCode > 0)
{
     Response.Write("Error occured while processing mp4 video");
     return;
}

//******************************************
// MP4 Encoding - Normal
//******************************************

_mhandler.OutputExtension = ".mp4";
_mhandler.FrameRate = 29.97;
_mhandler.Video_Bitrate = 200;
_mhandler.VCodec = "libx264";
_mhandler.Parameters = "-bt 240k -coder 1 -flags +loop -cmp +chroma -partitions +parti8x8+parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 3 -refs 2 -directpred 3 -trellis 0 -flags2 +wpred+dct8x8+fastpskip -wpredp 2";
_mhandler.Channel = 2;
_mhandler.Audio_SamplingRate = 48000;
_mhandler.Audio_Bitrate = 192;
info = _mhandler.Process();
if (info.ErrorCode > 0)
{
     Response.Write("Error occured while processing mp4 video");
     return;
}
//******************************************
// MP4 Encoding - ipod - ipone - 1 pass
//******************************************

_mhandler.OutputExtension = ".mp4";
_mhandler.FrameRate = 29.97;
_mhandler.Video_Bitrate = 512;
_mhandler.VCodec = "libx264";
_mhandler.Width = 480;
_mhandler.Height = 272;
_mhandler.AspectRatio = "480:272";
_mhandler.Parameters = "-bt 1024k -maxrate 4M -flags +loop -cmp +chroma -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq \\"blurCplx^(1-qComp)\\" -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -coder 0 -refs 1 -bufsize 4M -level 21 -partitions parti4x4+partp8x8+partb8x8 -subq 5";
_mhandler.Force = "mp4";
info = _mhandler.Process();
if (info.ErrorCode > 0)
{
      Response.Write("Error occured while processing mp4 video");
      return;
}
// ************************************
// Clear parameters
// ************************************

_mhandler.FrameRate = 0;
_mhandler.Video_Bitrate = 0;
_mhandler.VCodec = "";
_mhandler.AspectRatio = "";
_mhandler.Parameters = "";
_mhandler.Force = "";
_mhandler.Pass = 0;
_mhandler.Channel = 0;
_mhandler.Audio_Bitrate = 0;
_mhandler.Audio_SamplingRate = 0;
//************************************
// OGG Theora Encoding
//************************************

_mhandler.OutputExtension = ".ogg";
// set parameters with ogv video / ogg audio
info = _mhandler.Process();
if (info.ErrorCode > 0)
{
      Response.Write("Error occured while processing ogg file");
      return;
}
//***************************************
// VP8 WebM Encoding (Standard Version)
//***************************************

_mhandler.OutputExtension = ".webm";
_mhandler.Force = "webm";
_mhandler.AspectRatio = "4:3";
_mhandler.VCodec = "libvpx";
_mhandler.ACodec = "libvorbis";
_mhandler.Deinterlace = true;
_mhandler.Parameters = "-threads 8 -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -vb 2M -aq 50 -ac 6";
info = _mhandler.Process();
if (info.ErrorCode > 0)
{
      Response.Write("Error occured while processing webm video");
      return;
}
//****************************************************
// Grab Thumbs
//****************************************************

int calculate_mid_duration_sec = 5; // default 5 seconds
if (info.Duration_Sec > 0)
       calculate_mid_duration_sec = (int)info.Duration_Sec / 2;
//  create thumbnail
_mhandler.VCodec = "";
_mhandler.ACodec = "";
_mhandler.Force = "";
_mhandler.Parameters = "";
_mhandler.ImageName = "bear.png";
_mhandler.OutputFileName = "bear";
_mhandler.OutputExtension = "png";
_mhandler.Image_Format = "png";
_mhandler.Frame_Time = calculate_mid_duration_sec.ToString();
_mhandler.Width = 320;
_mhandler.Height = 240;
info = _mhandler.Grab_Thumb();
// check for errors
if (info.ErrorCode > 0)
{
     Response.Write("Error Occured while grabbing thumbs");
     return;
}
Response.Write("All tasks completed successfully");



Represent comments, so use code when required.

You can publish multiple format videos that can be playable on variety of ways, you can use mp4, webm, ogg vorbis to play on HTML 5 player.

ASP.NET HTML 5, VP8 WEBM Video Encoding using Media Handler Pro.

  • 24 July 2010

Everyone who has visited YouTube.com in the past four years knows that you can embed video in a web page. But prior to HTML5, there was no standards-based way to do this. Every video you've watched on the web has been funneled through a third party plugin (QuickTime, RealPlayer, Flash).

HTML5 defines a standard way to embed video in a web page, using a

<video width="300" height="150"></video>
element.

Support for the <video width="300" height="150"> element is still evolving, which is a polite way of saying it doesn’t work yet. At least, it doesn’t work everywhere. But don’t despair! There are alternatives and fallbacks and options.

 Video Codecs: There are tons of video codecs. The three most relevant codecs are H.264, Theora, and VP8.

H.264 is also known as “MPEG-4 part 10,” a.k.a. “MPEG-4 AVC,” a.k.a. “MPEG-4 Advanced Video Coding.” H.264 was also developed by the MPEG group and standardized in 2003. It aims to provide a single codec for low-bandwidth, low-CPU devices (cell phones); high-bandwidth, high-CPU devices (modern desktop computers); and everything in between. To accomplish this, the H.264 standard is split into “profiles,” which each define a set of optional features that trade complexity for file size. Higher profiles use more optional features, offer better visual quality at smaller file sizes, take longer to encode, and require more CPU power to decode in real-time.

Theora evolved from the VP3 codec and has subsequently been developed by the Xiph.org Foundation. Theora is a royalty-free codec and is not encumbered by any known patents other than the original VP3 patents, which have been licensed royalty-free. Although the standard has been “frozen” since 2004, the Theora project (which includes an open source reference encoder and decoder) only released version 1.0 in November 2008 and version 1.1 in September 2009.

Theora video can be embedded in any container format, although it is most often seen in an Ogg container. All major Linux distributions support Theora out-of-the-box, and Mozilla Firefox 3.5 includes native support for Theora video in an Ogg container. And by “native”, I mean “available on all platforms without platform-specific plugins.” You can also play Theora video on Windows or on Mac OS X after installing Xiph.org’s open source decoder software.

VP8 is another video codec from On2, the same company that originally developed VP3 (later Theora). Technically, it is similar in quality to H.264 Baseline, with lots of potential for future improvements.

In 2010, Google acquired On2 and published the video codec specification and a sample encoder and decoder as open source. As part of this, Google also “opened” all the patents that On2 had filed on VP8, by licensing them royalty-free. (This is the best you can hope for with patents. You can’t actually “release” them or nullify them once they’ve been issued. To make them open source–friendly, you license them royalty-free, and then anyone can use the technologies the patents cover without paying anything or negotiating patent licenses.) As of May 19, 2010, VP8 is a royalty-free, modern codec and is not encumbered by any known patents, other than the patents that On2 (now Google) has already licensed royalty-free.

Encoding VP8 WebM Video using Media Handler Pro.

FFMPEG 0.6 and latest provide support for VP8 Codec via libvpx. You need to download latest win 32 build in order to publish video to WebM format.

ample code for using ASP.NET Media Handler Pro to publish WebM Video

 

VideoInfo info = new VideoInfo();
 _mhandler.FileName = "sample.wmv";
_mhandler.OutputFileName = "sample";
_mhandler.OutputExtension = ".webm";
_mhandler.Force = "webm";
_mhandler.AspectRatio = "4:3";
_mhandler.VCodec = "libvpx";
_mhandler.ACodec = "libvorbis";
_mhandler.Deinterlace = true;
_mhandler.Parameters = "-threads 8 -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -vb 2M -aq 50 -ac 6";
info = _mhandler.Process();
if (info.ErrorCode > 0)
{
         Response.Write("Error occured while processing webm video");
         return;
}

After publishing you can then play WebM video on HTML 5 player (e.g player provided by http://videojs.com/ Sample way to play WebM Video

<video width="320" height="240"><source src="sample.webm" type='video/webm; codecs="vp8, vorbis"'></video>

Extracting Frames from video and Re encoding images into video using ASP.NET Media Handler Pro.

  • 09 July 2010
You can use the following code through ASP.NET Media Handler Pro
\r\ncomponent to extract all frames of video into jpg images.
\r\nExtracting Frames:
\r\n[quote]
\r\n_mhandler.InputPath = RootPath + "\\\\contents\\\\original";
\r\n_mhandler.OutputPath = RootPath + "\\\\contents\\\\thumbs";
\r\n_mhandler.FileName = "xmen-origins-wolverine.mp4";
\r\n_mhandler.OutputFileName = "sample_";
\r\n_mhandler.OutputExtension = "%010d.jpg";
\r\n_mhandler.Force = "image2";
\r\nVideoInfo info = _mhandler.Process(); [/quote]
\r\nRe Encoding Frames / Images into Video:
\r\nExample below will encode all jpg frames into flash flv video, you can
\r\nencode it in any format.
\r\n[quote]
\r\n_mhandler.InputPath = RootPath + "\\\\contents\\\\thumbs";
\r\n_mhandler.OutputPath = RootPath + "\\\\contents\\\\flv";
\r\n_mhandler.FileName = "sample_.%010d.jpg";
\r\n_mhandler.OutputFileName = "sample_img_vid";
\r\n_mhandler.OutputExtension = "flv";
\r\n_mhandler.Force = "flv";
\r\n// _mhandler.MaxQuality = true;
\r\n_mhandler.Audio_Bitrate = 32;
\r\n_mhandler.Audio_SamplingRate = 22050;
\r\nVideoInfo info = _mhandler.Process(); [/quote]
\r\nIf you receive Error Code 101, you can request updated MHP through our
\r\nsupport email.

ASP.NET Video Uploader User Control.

  • 28 April 2010

ASP.NET Video Uploader Control (.ascx file) include complex script that can handle video uploading, publishing to flash flv format, grabing single or multiple thumbs, set meta data for flash flv video, output validation and retrieve useful information from video in one step just by dragging control on page by allowing developer to avoid writing lots of code.

Visit Official Page of Video Uploader Control. for more detail, demo and example codes.

Features:
Main features in ASP.NET Video Uploader Control includes,

  • Video Uploading
  • Video publishing using .NET Media Handler Pro component.
  • Set Meta Information for flash flv video.
  • Grab single or multiple thumbs.
  • Post watermark on output video. (optional)
  • Validation of source and output video.
  • Create audio mp3 file (optional).
  • and more.

Languages:

ASP.NET Video Uploader Control support both c# and vb.net.

Sample Code for using ASP.NET Video Uploader Control:
Just grab upload.ascx file on page where you want video uploading functionality.
In codebehind file set upload.ascx main properties as mentioned below.

// folder path where source video will store after uploading. 
upload1.OriginalPath = RootPath + "\\\\contents\\\\original";// folder path where flash flv video will store after publishing
upload1.FLVPath = RootPath + "\\\\contents\\\\flv"; // folder path where video thumbs will store.
upload1.ThumbPath = RootPath + "\\\\contents\\\\thumbs"; // watermark image path if required. (optional)
upload1.WatermarkPath = RootPath + "\\\\contents\\\\watermark"; upload1.WatermarkImage ="watermark.gif"; // allowed source video formats.
upload1.VideoAllowableExtensions = "mp4,avi,wmv,flv,mpg,mpeg,mov"; // max video size in MB. upload1.MaxVideoSize = 10; // grab single or multiple thumbs from video.
upload1.isMultipleThumbs = true; // 15 thumbs will be grabbed.


You can customize uploader component by adding more fields and store retrieved information in media tables for later processing.
This control is available with the following packages available for purchase on http://www.mediasoftpro.com/purchase.html

 

Feedback will be appreciated.

Media Handler Pro 5.0 Released

  • 07 April 2010

.NET Media Handler Pro media processing component version 5.0 has been released with lots of improvements, addition of advance features and simplifying code for handling advance level of media processing.

What's New in Media Handler Pro 5.0:

    • Generalize way to process any format media file to another format. learn more.
    • Joining and encoding two or more video clips in one output file.
    • Improved script for splitting video in small clips.
    • Images to video conversion.
    • Improved script for grabbing multiple thumbs. Now support grabbing thumbs from long length videos.
    • Support using x264 preset files for encoding high quality h264 videos using libx264 codec.
    • Redesigned parsing script for more efficiently retrieving media information from videos.
    • More control on error handling and information parsing.

 

Media Handler Pro ver 5.0 Documentation:

http://www.mediasoftpro.com/mediahandlerpro-v5-documentation.html

For more information visit Media Handler Pro 5.0 Documentation.

Normal and widescreen video conversion without stretching.

  • 19 January 2010

When you encode normal video (4:3 aspect ration) to widescreen (16:9) video, or in reverse widescreen to normal video, video is stretch out and in result output distorted or bad in view and quality.
In order to avoid video stretching out and keep aspect ratio of video persistent, you can use technique called pillars. This is the "pure" method as it does not distort or lose any part of the original video or image. In this technique you will calculate space and add padding accordingly on proper direction to keep the aspect ratio of video consistent.
Logic to calculate padding size and direction.

1: Widescreen (16:9) to Normal (4:3) video conversion:
Example:
i: Calculate width and height of source video (16:9): e.g 800x450 = 1.7777.
ii: Width and height of normal video that you want to publish e.g 320x240 = 1.333.
iii: Actual widescreen height of video based on output width : 320/1.77777 = 180.
iv: Calculate the difference between normal height and widescreen height = 240 - 180 = 60.
v: Divide 60 in two pieces will get the padding size for each side of video 60/2 = 30.
vi: In case of widescreen to normal conversion, difference comes in height so you will add padding on top and bottom of video.
So parameters for widescreen video (800x450) to normal video (320x240) conversion without stretching is

  • Width: 320px
  • Height: 180px
  • Padding Top: 30px
  • Padding Bottom: 30px

The result video size will be 320x240 or (4:3 aspect ratio) video.
You can achieve same settings through  ASP.NET Media Handler Pro as

     _mhandler.Width = 320; _mhandler.Height = 180; _mhandler.PadTop = 30; _mhandler.PadBottom = 30;



1: Normal (4:3) to Widescreen (16:9) video conversion:
Example
i: Same as above first get width and height of source video (4:3). e.g 800x600 = 1.3333.
ii: Width and height of output widescreen video. e.g 320x180 = 1.7777.
iii: Actual normal width of video based on widescreen height = 180x1.333 = 240
iv: Calculate the different between normal and widescreen widths = 320-240 = 60
v:  Divide 60 in two pieces will get the padding size for each side of video 60/2 = 30.
vi: In case of normal to widescreen conversion, difference comes in widths so you will add padding on left and right of video.
So parameters for normal video (800x600) to widescreen video (320x160) conversion without stretching is

 

    • Width: 240px
    • Height: 180px
    • Padding Left: 30px
    • Padding Right: 30px

 

You can achieve same settings through ASP.NET Media Handler Pro as

      _mhandler.Width = 320;      _mhandler.Height = 180;     _mhandler.PadLeft= 30;     _mhandler.PadRight= 30;


Checking video aspect ration:

Just divide width/height you will get aspect ratio of video. If you receive value like 1.333 it means video is normal video. If you receive value like 1.777 it means its widescreen video.

Note: In order to achieve conversion without stretching you must know

    • Source video type whether its widescreen or normal video.
    • In case of widescreen to normal video conversion, padding to be put on top and bottom of video based on logic describe above.
    • In case of normal to widescreen video conversion, padding to be put on left and right of video based on logic as discussed above.

 

ASP.NET Media Handler Pro Documentation:
http://www.mediasoftpro.com/mediahandlerpro-v4-documentation.html
We appreciate feedback and comments.

Flash video progressive download & streaming via HTTP in ASP.NET

  • 17 January 2010

Flash Video files can be stream & delivered in several different ways on the web. Main delivery options are.

    • As a standalone .FLV file.
    • Embedded in SWF file using Flash Authoring Tool.
      Progressive Download via HTTP.
    • Streaming via RTMP to the Flash Player using Flash Media Server.

 

Standalone .FLV File:
It is the normal way to deliver Flash video using a Flash player to control. The .FLV file itself is only playable with an FLV player.
Embedded in SWF File:
In this approach, the entire file must be transferred before playback can begin. Changing the video requires rebuilding the SWF file.
Streaming via RTMP to the Flash Player using Flash Media Server.
Streamed via RTMP to the Flash Player using the Flash Media Server (formerly called Flash Communication Server).
Progressive Download via Http:
This method uses ActionScript to include an externally hosted Flash Video file for playback. Progressive download has serveral advantages, including buffering, use of generic HTTP servers and the ability to reuse a single SWF player for multiple Flash Video sources.
In this way you can access video files using the partial download functionality of HTTP, sometime referred to as streaming.
However, unlike streaming using RTMP, HTTP "streaming" does not support real-time broadcasting.
Streaming via HTTP requires a custom player and the injection of specific Flash video metadata containing the exact starting position in bytes and timecode of easy keyframe. Using this specific information, a custom Flash Video player can request any part of the Flash Video file starting at a specified keyframe.
e.g our demo kit, Video Starter Kit Advance Edition support pseudo-streaming & progressive downloading and can seek to any part of the video before buffering is complete.
The server side part of this "HTTP pseudo-streaming" method is fairly simple to implement. Here we add information about how to use or generate server script in ASP.NET to achieve Flash video pseudo-streaming or progressive download capability.
We generate pseudo-streaming script for ASP.NET that can help you to implement Flash video HTTP progressive download & pseudo streaming in ASP.NET
Live demo of ASP.NET pseudo-streaming script is on
http://www.remix-video.com/video/374/legion-trailer.aspx
You can download streaming script from
http://www.mediasoftpro.com/downloads/stream.zip
Configuring ASP.NET HTTP streaming Script:
1: Configuring Flash video directory path

private string _vsk_path_files = "/contents/member/";

The above code will set directory root path where Flash video store and will stream.
2: Configure list of allowed domains for streaming.
 private static string[] _allowed_domains = new string[] { "www.remix-video.com", "www.mediasoftpro.com"};

Put list of domains that you want only to be allowed for streaming or accessing Flash video files.
3: Configure list of restricted domains for accessing Flash content.
 private static string[] _restricted_domains = new string[] { "www.sampledomain.com", "www.sampledomain2.com", "www.sampledomain3.com" };

Using ASP.NET HTTP streaming Script in Flash Player:
First you need to make sure that whether Flash Player that you are using support HTTP Streaming.
The below example uses JW Player for accessing ASP.NET HTTP streaming script, read configuration and stream video based on configuration.
s1.addVariable("streamer","http://www.example.com/vsk/stream/streamer.ashx");s1.addVariable("token","UserID");

The above two lines configure HTTP streaming for JW Player. Token can be any value and is used for validation purpose.
In demo kit Video Starter Kit Advance Edition we used token for sending unique user id to script that helps to generate path for user video files for streaming.
Your feedback is appreciated to improve ASP.NET script more for HTTP streaming.

ASP.NET Media Handler Pro Basic Features.

  • 17 January 2010

ASP.NET Media Handler Pro is an ASP.NET video encoding utility that provide ability to publish / encode any format videos from one format to another format, prepare videos to be stream on the web, grab single / multiple thumbs, post watermark, retrieve information from videos and perform lots of other useful video processing tasks.
\r\nYou can use ASP.NET Media Handler Pro component in any applications that is compatible with Microsoft .NET Framework.
\r\nApplication may include.

  • ASP.NET web applications written in C# or VB.NET.
  • .NET windows based applications.
  • .NET web services.
  • .NET win services.
  • and more.

Main purpose of ASP.NET Media Handler Pro is to

    • Encode videos to be stream and play on variety of devices and web browsers.
    • Grab thumbs to represent videos in galleries.
    • Post watermark on videos while encoding to protect copyright contents.
    • Prepare online streaming videos (Flash Videos etc) to be playable on variety of devices.
    • Prepare different format audio files from videos.
    • and more.

 

In case of ASP.NET applications, ASP.NET Media Handler Pro can be used on both shared hosting plans that support full trust asp.net configuration & dedicated servers.
You can download ASP.NET Media Handler Pro trial version from
http://www.mediasoftpro.com/downloads.html

ASP.NET Media Handler Pro Documentation:
url]http://www.mediasoftpro.com/mediahandlerpro-v4-documentation.html[/url]

We appreciate your feedback for improving ASP.NET Media Handler Pro functionality more to make it more useful for your needs.