在视频和音频文件中添加水印 [英] Adding a watermark to Video and Audio Files

查看:121
本文介绍了在视频和音频文件中添加水印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我需要一些dll或代码来帮助我在音频或视频文件中添加水印.
我在网上进行了一些搜索,但是大多数搜索结果都包含Microsoft.Directx,我无法帮助您.

提前Thnx

Hello all.

I need some dll or code that helps me add a watermark to audio or video files.
I did some search online but most results included Microsoft.Directx which I couldn''t can you please help me with this.

Thnx in advance

推荐答案

我怀疑是否有任何.NET组件或自由组件允许这样做.您可能需要第三方组件.

请看以下讨论:
视频数字签名 [ ^ ]
如何在视频文件上添加水印? [ ^ ]
I doubt if any .NET component or free component allows the same. You might need a third party component for it.

Have a look at the following discussions:
Digital SIgnature on video[^]
How to add watermark on video file? [^]


使用适用于.NET的GDI +创建水印照片 [ ^ ]

http://stackoverflow.com/questions/1224653/place- watermark-image-on-other-images-c-asp-net [在C#中构建简单的水印实用程序 [ ^ ]

视频

http://social.msdn.microsoft.com/论坛/en-AU/csharplanguage/thread/4b745477-32b8-4133-ab50-6aa82628fbec [
Creating a Watermarked Photograph with GDI+ for .NET[^]

http://stackoverflow.com/questions/1224653/place-watermark-image-on-other-images-c-asp-net[^]

Build a Simple Watermarking Utility in C#[^]

Video

http://social.msdn.microsoft.com/Forums/en-AU/csharplanguage/thread/4b745477-32b8-4133-ab50-6aa82628fbec[^]


我为您制作了一个函数.您可以为视频的每个帧(假定帧带有水印)调用此函数.

//由Muhtar Qong创建:2012年5月7日
公共图像AddWaterMarkToVideoFrames(图像videoFrame,图像waterMark,浮动透明度)
{
System.Drawing.Imaging.ImageAttributes ia =新System.Drawing.Imaging.ImageAttributes();
System.Drawing.Imaging.ColorMatrix cm =新的System.Drawing.Imaging.ColorMatrix();
cm.Matrix33 =透明度;
ia.SetColorMatrix(cm);
图形g = null;
试试
{
g = Graphics.FromImage(videoFrame);
//Rene Des Cartes:1596年;您可以自由定义矩形大小.
Rectangle rect = new Rectangle((int)(videoFrame.Width * 0.1),(int)(videoFrame.Height * 0.2),(int)(videoFrame.Width * 0.8),(int)(videoFrame.Height * 0.6)) ;
g.DrawImage(waterMark,rect,0,0,waterMark.Width,waterMark.Height,GraphicsUnit.Pixel,ia);
返回videoFrame;
}
catch(ex ex例外)
{
扔前;
}
终于
{
g.Dispose();
}
}

请复制并尝试.
I have made a function for you. You may call this function for each frame of your video which frames are suppose to be water marked.

// Created by Muhtar Qong: May 7, 2012
public Image AddWaterMarkToVideoFrames(Image videoFrame, Image waterMark, float transparency)
{
System.Drawing.Imaging.ImageAttributes ia = new System.Drawing.Imaging.ImageAttributes();
System.Drawing.Imaging.ColorMatrix cm = new System.Drawing.Imaging.ColorMatrix();
cm.Matrix33 = transparency;
ia.SetColorMatrix(cm);
Graphics g = null;
try
{
g = Graphics.FromImage(videoFrame);
// Rene Des Cartes: 1596; You may define the rect size freely.
Rectangle rect = new Rectangle((int)(videoFrame.Width * 0.1), (int)(videoFrame.Height * 0.2), (int)(videoFrame.Width * 0.8), (int)(videoFrame.Height * 0.6));
g.DrawImage(waterMark, rect, 0, 0, waterMark.Width, waterMark.Height, GraphicsUnit.Pixel, ia);
return videoFrame;
}
catch (Exception ex)
{
throw ex;
}
finally
{
g.Dispose();
}
}

Please copy this and try it.


这篇关于在视频和音频文件中添加水印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆