本文介绍了如何在现有视频上加水印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道应该使用哪个库.请帮助我获取该库,或者如果可用的话,请提供其他任何来源
I dont know which library should I use. Please help me to get the library or please provide any other source if available
// this demonstrates one way of watermarking a video clip...
string outputFile = "WatermarkVideoClip.wmv";
using (ITimeline timeline = new DefaultTimeline(15))
{
// greate our default audio track
timeline.AddAudioGroup().AddTrack();
// add a video group, 32bpp, 320x240 (32bpp required to allow for an alpha channel)
IGroup videoGroup = timeline.AddVideoGroup(32, 320, 240);
// 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.
timeline.AddVideoWithAudio("transitions.wmv");
// 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( "testlogo.gif", 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(0.8));
// 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.CreateDxtKey(DxtKeyTypes.Alpha, null, null, null, null, null),
false);
using (
// render it to windows media
IRenderer renderer =
new WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo))
{
renderer.Render();
}
}
推荐答案
这篇关于如何在现有视频上加水印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!