How To Resize video upon watermark....

Topics: Developer Forum, Project Management Forum, User Forum
Jul 29, 2010 at 9:45 AM


I am working on this watermark.its working fine...but the problem is the actual size of the video is disturbed...say my input file is of resolution 1024X768 i am getting 320X240 which is not so pleasant. I need a video size of 720X480 please review the below code and help me in achieving the code i am looking for.....Thanks in advance


  #region WaterMark
        private void AddWaterMark(object row)

            DataRow Drow = (DataRow)(row);
            DirectoryInfo info = new DirectoryInfo(Convert.ToString(Drow["FilePath"]));
            string[] filename = info.Name.Split('.');
            string outputFile = ClassTransport.ClipSavePath + "\\" + filename[0] + "WaterMarked" + info.Extension;

            using (ITimeline timeline = new DefaultTimeline(32))

                // add a video group, 32bpp, 320x240 (32bpp required to allow for an alpha channel)

              IGroup videoGroup = timeline.AddVideoGroup(32, 720, 480);


                // add our default video track
                ITrack videoTrack = videoGroup.AddTrack();

                // add another video track, this will be used to contain our watermark image

                ITrack watermarkTrack = videoGroup.AddTrack();

                // add the video in "transitions.wmv" to the first video track, and the audio in "transitions.wmv"

                // to the first audio track.


                Bitmap image, BImage,TextImage;
                image = new Bitmap(int.Parse(ConfigurationSettings.AppSettings["VideoWidth"].ToString()), int.Parse(ConfigurationSettings.AppSettings["VideoHeight"].ToString()));
                BImage = new Bitmap(int.Parse(ConfigurationSettings.AppSettings["VideoWidth"].ToString()), int.Parse(ConfigurationSettings.AppSettings["VideoHeight"].ToString()));
                TextImage = new Bitmap(int.Parse(ConfigurationSettings.AppSettings["VideoWidth"].ToString()), int.Parse(ConfigurationSettings.AppSettings["VideoHeight"].ToString()));
                TextImage = CreateBitmapImage(Drow);
                image = CloneImage(TextImage);
                //TODO:Adding Logo Call in Form 1
                if (Drow["Logo"] != null)

                    BImage = ((Bitmap)Image.FromFile(Drow["Logo"].ToString()));
                    image = CloneLogoWithImage(BImage, image, Drow);


                // add the watermark image in, and apply it for the duration of the videoContent

                // this image will be stretched to fit the video clip, and in this case is a transparent gif.

                IClip watermarkClip = watermarkTrack.AddImage(image, 0, videoTrack.Duration);

                // add a alpha setter effect to the image, this will adjust the alpha of the image to be 0.5

                // of it's previous value - so the watermark is 50% transparent.

                watermarkClip.AddEffect(0, watermarkClip.Duration, StandardEffects.CreateAlphaSetterRamp(((double)Drow["Opacity"])));

                // add a transition to the watermark track, this allows the video clip to "shine through" the watermark,

                // base on the values present in the alpha channel of the watermark track.

                watermarkTrack.AddTransition(0, videoTrack.Duration,

                                        StandardTransitions.CreateKey(KeyTransitionType.Alpha, null, null, null, null, null),


                //using (

                // render it to windows media

                IRenderer renderer = new WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo);

                // {
                using ((System.IDisposable)renderer)


            Drow["filePath"] = outputFile;

Jul 30, 2010 at 9:11 AM
IRenderer renderer = new WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo); You have to recompile the Splicer Library with a new WindowsMediaProfiles with the settings that you wish to use. Use: To build the media profile.
Aug 11, 2010 at 5:14 AM
Edited Aug 11, 2010 at 5:15 AM
Thanks a worked.......... :-)
Aug 11, 2010 at 2:06 PM
Your welcome, pleased to be of assistance.
Nov 5, 2010 at 8:08 PM
Edited Nov 5, 2010 at 8:13 PM

Hi .

I have the same problem .

I new in developing sow i don't know how to "RECOMPILE"   Splicer library  .

I tried to use AVI Render , and my file became huge ! 8 sec video more then 700 MB , then i realized that i didn't choose codecs , but i don't know how to do it anyway , sow i decided to use WinMed Render  after all .

Please help. I wonder if any one can provide me with new recompiled Splicer Lib  , my e-mail



Nov 6, 2010 at 3:23 PM

You must download the project files for the splicer dll from this site, change or add a WindowMediaProfiles which you create using the link in my previous post.

Dec 3, 2010 at 7:31 PM
Edited Dec 3, 2010 at 7:32 PM

I'm very new to Splicer and to coding video stuff generally, so forgive me if my comments seem incorrect, or critical. I don't want to upset or criticise anyone.

Shouldn't a library such as Splicer come with the ability to choose the size of the output?

Are you saying that every individual user most recreate the media profiles and recompile the libraries just to get other output sizes than the one default size, which appears to be 320x240?

Surely, some standard sizes such as 640x480 should be included in the library. I can understand having to create your own profile for something very non-standard like say 817x297 (I just made that up) but standard sizes such as those used at YouTube, etc - shouldn't they be included?

I realise this is a user-maintained and free library, so I'm very thankful for it and all the power it is already giving me, but isn't output size a fundamental requirement of a library like this?

Dec 3, 2010 at 7:37 PM
d347hm4n wrote:
IRenderer renderer = new WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo); You have to recompile the Splicer Library with a new WindowsMediaProfiles with the settings that you wish to use. Use: To build the media profile.

 I've tried to follow that link to be able to create a new profile for the size I need, but I don't see anything there that allows me to build a profile.

Does anyone who has created additional profiles have something they can share?


Dec 3, 2010 at 8:35 PM

I think it must be that Microsoft have changed the page being linked to above.

After some research, it seems to me that I need to get hold of a copy of Windows Media Encoder, which I have found at

but that page says it is no longer supported and benig retired in Mid-2010 in favour of Expression Encoder.

Anyway, I'm going to download a copy of Windows Media Encoder and hope that it helps me to make additional video profiles.

Could someone who is more experienced with Splicer please correct any errors or asuumptions I have made so that other users are not led astray by my comments?




Dec 6, 2010 at 2:06 PM

The windows media renderer requires a windows media profile. However, to use another profile DOES NOT require you to recompile the code, you merely need to read the profile into a string and pass that in as the profile for the renderer. In order to change the size of the video output, you can copy the .prx files used by Splicer and edit the values within them, and then read the newly created files into a string which is then passed to the renderer.

Hope that helps some.

Dec 6, 2010 at 10:35 PM

d347hm4n wrote:
IRenderer renderer = new WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo); You have to recompile the Splicer Library with a new WindowsMediaProfiles with the settings that you wish to use. Use: To build the media profile.


I was basing my reply on the above quote which led me to believe that it was necessary to recompile to be able to use additional profiles.

I'll look more closely at the code and try to work out how to use the profiles in the way that you suggest.

Thanks for your help and suggestions.

Dec 7, 2010 at 12:15 PM

I didn't realise you could pass in the profile to the encoder as string.

I would still recommend that the profile be created with the Widows Media Encoder as those encoding profiles aren't exactly straightforward to write. Although having said this, if they have discontinued support for the windows media encoder it will be pretty tricky creating these profiles :S

I will continue to watch this topic if you need any further assistance, although I'm not exactly the most experienced developer in the world....

Dec 7, 2010 at 12:56 PM
Edited Dec 7, 2010 at 12:57 PM

I have discovered that, because the prx file is just a text file in xml format, you can even just use a text editor and change dimension values, and get your alternative sizes that way, so I don't think the lack of the encoder to edit the prx files is going be a real major issue.

It would be nice to have got a wider selection of profiles as part of the library, but I'm just going to create the ones I need for my application.

Thanks for the help so far guys. This is a very steep learning curve for me, but you helped me along. Thanks.

And thanks to everyone who has helped put this awesome library together. It's saving me masses of time.



Dec 8, 2010 at 9:04 AM

Thanks for the info JamieB. I have been too lazy to add some more sophisticated profiles to my application because I couldn't be bothered re-installing the encoder and re-compiling the splicer .DLL, but if it's as simple as having a .prx in the project then it's a time saver!

Dec 9, 2010 at 8:31 PM
string profile = new StreamReader(profileLocation).ReadToEnd();
using (WindowsMediaRenderer renderer = new WindowsMediaRenderer(timeline, fileName, profile))

Use above to read in additional profiles.

Feb 19, 2011 at 8:25 PM

If you have useful windows media profiles you would like to see bundled into Splicer by default, please post them here (or provide a patch) and we can add them to the codebase - to give users more options when encoding video.