VUploader returns various type of error code when error happens while processing video and audio file. This document provide detail about these error codes.
ASP.NET Video Uploader & Publisher user control include complex encoding and validation script that can provide flexibility to developers to write reliable and professional script for uploading and publishing media files (video, audio) to another format, grab single or multiple thumbs, post watermark and retrieve various information from output media in one step using ASP.NET.
ASP.NET Video Uploader user control uses .NET Media Handler Pro component to publish media files and perform other media related processings.
Main feature includes
- Upload video and audio files.
- Publish video files in flash flv format (default option), mp4 format, wmv format,
- Publish video or audio files in mp3 format,
- Grab single or multiple thumbs from video,
- Post watermark on video,
- Retrieve information from published video, audio file and thumbs,
- Complex validation script to validate and rollback all operation in case of video processing failure.
Note: ASP.NET Video Uploader user control can be used to publish eigther videos (flv, mp4, wmv) or audio file (mp3) in one time. It can't publish both video and audio file at same time. You need to handle video and audio files separately by using uploader user control separately for different use on different pages.
Using ASP.NET Video Uploader User Control:
You can use ASP.NET Video Uploader user control easily in your asp.net application. Just drag user control on your page where you want to implement it.
You can use the following steps to implement or use asp.net video uploader user control. Complete project is available with user control which can help developer to implement it more easily.
1: Drag user control on page where you want to implement video uploading and publishing.
2: Open codebehind file and setup video uploader properties as mentioned below
// set ffmpeg path, make sure ffmpeg folder exist on root of your web application.
upload1.FFMPEGPath = RootPath + "\\ffmpeg\\ffmpeg.exe";
// set flvtool path for setting meta information for flv videos, make sure flvtool folder available on root of your web application.
upload1.FLVToolPath = RootPath + "\\flvtool\\flvtool2.exe";
// set directory path where original video will store after uploading.
upload1.OriginalPath = RootPath + "\\contents\\original";
// set directory path where flv, mp4, wmv, mp3 files will store after publishing.
upload1.FLVPath = RootPath + "\\contents\\flv";
// set directory path where thumbs file will store after capturing from video.
upload1.ThumbPath = RootPath + "\\contents\\thumbs";
// set watermark directly path where transparent watermark image exist. Note ffmpeg must support and include vhook/watermark.dll to post watermark on video. more detail
upload1.WatermarkPath = RootPath + "\\contents\\watermark";
//set transparent watermark image filename.
// set allowable video, audio file extensions.
upload1.VideoAllowableExtensions = "mp4,avi,wmv,flv,mpg,mpeg,mov";
// set max allowable video uploading size in MB
upload1.MaxVideoSize = 10;
// set whether to generate single image or multiple images to create story board for video. In case of multiple images. Video Uploader will generate 15 images from start to end of video.
upload1.isMultipleThumbs = false;
3: Next you can customize ASP.NET Video Uploader user control with your own requirements. Open user control located at /modules/upload.ascx file. There are lots of optional fields in user control that can be used or removed if not required as mentioned below.
List of fields in Video Uploader Control:
- Title: Can be used to set title of video or audio file.
- Description: Can be used to set description of video or audio file.
- Tags: Can be set tags related to video or audio file
- Category: Can be used to assign category for video or audio file.
- Set Video: Flag media as public or private
- Browse Videos: (required) allow you to upload video or audio file.
4: In codebehind of ASP.Net Video Uploader user control you can set various settings related to video and audio publishing as mentioned below.
// setting output video type: not you must set video settings compatible to flash flv, mp4 and wmv format below. 0: flash flv, 1: mp4, 2: wmv
_vprocess.Output_Type = 0;
// Video Settings
_vprocess.Width = 320; // width of video
_vprocess.Height = 240; // height of video
_vprocess.Video_Bitrate = 500; // video bitrate of video
_vprocess.Video_aBitrate = 128; // audio bitrate of video file
_vprocess.Video_SamplingRate = 44100; // audio sampling rate for flv video
// thumb settings
_vprocess.Thumb_Width = 150; // width of thumb image
_vprocess.Thumb_Height = 150; // height of thumb image
// Audio settings
// Note: if this will override / disable video encoding option and will just generate audio mp3 file
_vprocess.isAudio = false; // disable audio encoding. make it true in order to publish audio file in mp3 format.
_vprocess.Audio_Bitrate = 192; // set mp3 audio bitrate
_vprocess.Audio_SamplingRate = 48000; // set mp3 audio sampling rate
5: The following video information can be retrieved after publishing completes. These information can be stored in database by developer along with other video or audio information.
// retrieve output video or audio file name
flv_filename = vinfo.FLVVideoName;
// retrieve original video or audio file name
original_filename = vinfo.OriginalVideoName;
// retrieve thumb filename ( in case of multiple thumbs default center thumb filename retrieved) all thumb filename are in sequence e.g 001, 002, 003 ...
thumb_filename = vinfo.ThumbFileName;
// retrieve total duration of video in original format e.g 4.35
duration = vinfo.Duration;
// retrieve duration of video in seconds format. e.g 120 seconds
duration_sec = vinfo.Duration_Sec;
// retrieve flag to make sure video and all other processing completed successfully. 0 will show success, 1 will show something wrong happens.
isenabled = vinfo.isEnabled;