MP4 and M4V both are extensions of MPEG-4 files. MPEG-4 is most commonly used to store digital audio and digital video streams especially those defined by MPEG. MPEG-4 also allows streaming on internet. The official filename extension for MPEG-4 file is .mp4.
MP4, M4V and M4A files play on iPhone, iPod, mobile phones, web, play station 3, xbox 360 and more hardwares.
Media Handler Pro can be used to create the MP4, M4V and M4A video and audio files, view examples below or contact us for more help.
Example shown below is related with Media Handler Pro version 3.0.
// Sample code for encoding any format video to mp4 format.
MediaHandler _mhandler = new MediaHandler();
// required properties
string RootPath = Server.MapPath(Request.ApplicationPath);
_mhandler.FFMPEGPath = HttpContext.Current.Server.MapPath("~\\ffmpeg\\ffmpeg.exe");
_mhandler.InputPath = RootPath + "\\contents\\video";
_mhandler.OutputPath = RootPath + "\\contents\\mp4";
_mhandler.FileName = "sample.mpg";
// optional output filename
_mhandler.OutputFileName = "sample.mp4";
// setting video related properties, required in case of mp4 video otherwise may result in failure of video encoding.
_mhandler.FrameRate = 29.97;
_mhandler.Video_Bitrate = 786;
_mhandler.Audio_Bitrate = 64;
_mhandler.Audio_SamplingRate = 24000;
// generate highest quality mp4 video, note by making this option true, video bitrate will no longer work.
_mhandler.MaxQuality = true;
// optional video width and height settings
_mhandler.Width = 320;
_mhandler.Height = 240;
// optional video and audio codec settings, make sure it is compatible with mp4 video otherwise result in failure of video encoding.
_mhandler.ACodec = "libfaac";
_mhandler.VCodec = "mpeg4";
// posting watermark on mp4 video, view detail in watermark section
_mhandler.WaterMarkPath = RootPath + "\\contents\\watermark";
_mhandler.WaterMarkImage = "watermark.gif";
// start processing video
string output = _mhandler.Encode_MP4();
// validate output with error codes in order to make sure mp4 video is published successfully.
// Sample code for encoding any format video to m4v format.
MediaHandler _mhandler = new MediaHandler();
// required properties
string RootPath = Server.MapPath(Request.ApplicationPath);
_mhandler.FFMPEGPath = HttpContext.Current.Server.MapPath("~\\ffmpeg\\ffmpeg.exe");
_mhandler.InputPath = RootPath + "\\contents\\video";
_mhandler.OutputPath = RootPath + "\\contents\\mp4";
_mhandler.FileName = "sample.mpg";
// optional output filename
_mhandler.OutputFileName = "sample.m4v";
// setting video related properties, required in case of mp4, m4v, m4a video otherwise may result in failure of video encoding.
_mhandler.FrameRate = 29.97;
_mhandler.Video_Bitrate = 786;
_mhandler.Audio_Bitrate = 64;
_mhandler.Audio_SamplingRate = 24000;
// generate highest quality mp4 video, note by making this option true, video bitrate will no longer work.
_mhandler.MaxQuality = true;
// optional video width and height settings
_mhandler.Width = 320;
_mhandler.Height = 240;
// optional video and audio codec settings, make sure it is compatible with mp4 video otherwise result in failure of video encoding.
_mhandler.ACodec = "libfaac";
_mhandler.VCodec = "mpeg4";
// posting watermark on m4v video, view detail in watermark section
_mhandler.WaterMarkPath = RootPath + "\\contents\\watermark";
_mhandler.WaterMarkImage = "watermark.gif";
// start processing video
string output = _mhandler.Encode_M4V();
// validate output with error codes in order to make sure m4v video is published successfully.
// Sample code for encoding any format video to m4a format.
MediaHandler _mhandler = new MediaHandler();
// required properties
string RootPath = Server.MapPath(Request.ApplicationPath);
_mhandler.FFMPEGPath = HttpContext.Current.Server.MapPath("~\\ffmpeg\\ffmpeg.exe");
_mhandler.InputPath = RootPath + "\\contents\\video";
_mhandler.OutputPath = RootPath + "\\contents\\mpa";
_mhandler.FileName = "sample.mpg";
// optional output filename
_mhandler.OutputFileName = "sample.mpa";
// setting audio related properties, required in case of mp4, m4v, m4a video otherwise may result in failure of video encoding.
_mhandler.Audio_Bitrate = 64;
_mhandler.Audio_SamplingRate = 24000;
// optional audio codec settings, make sure it is compatible with mp4 video otherwise result in failure of video encoding.
_mhandler.ACodec = "libfaac";
// start processing video
string output = _mhandler.Encode_M4A();
// validate output with error codes in order to make sure m4a video is published successfully.