0

I have applied watermark on an image using c#. Now, I wanted to add a logo or watermark on the video using c#.

Can anybody suggest some ways to achieve this.

Any help would be greatly appreciable.

Dhvani Shah
  • 351
  • 1
  • 7
  • 17
  • [How to Overlay or Superimpose an Image onto a Video in C#](https://stackoverflow.com/a/14077022/868014) – Roman R. Mar 05 '18 at 07:12
  • Thanks Roman. But the code is not executing. – Dhvani Shah Mar 05 '18 at 11:45
  • 1
    You are supposed to show research effort, try the existing solution and answers and narrow down the problem, esp. providing details on what exactly is not working. The way you asked the question, it is an "overly broad" off-topic. – Roman R. Mar 05 '18 at 12:24
  • Sure. I have starting using python where I have separated audio from the video, fetched the frames from the video, applied watermark on each frame using opencv. Now, try to do reverse the process. – Dhvani Shah Mar 06 '18 at 06:07

1 Answers1

2

If you are ok to use ffmpeg then you can add the overlay with ffmpeg using a command like this:

ffmpeg -i inputVideo.mp4 -i yourwatermark.png -filter_complex "overlay=5:5" -codec:a copy outputVideo.mp4

See this answer for more examples of placing the watermark - i.e. top left, bottom right etc: https://stackoverflow.com/a/10920872/334402

Using ffmpeg from many environments is often easiest done via a well supported wrapper library - this is speaking as someone who first used a homemade wrapper (in a different environment - not c#) but wished I had used a library!

However, c# does not seem to have a well supported ffmpeg wrapper, so it looks like you would need to execute the ffmpeg program yourself using a 'new Process()'. There is an example of this in this answer here: https://stackoverflow.com/a/7350411/334402

Mick
  • 24,231
  • 1
  • 54
  • 120
  • Thanks Mick. I achieved the task using the ffmpeg and following this tutorial: (https://www.pyimagesearch.com/2016/04/25/watermarking-images-with-opencv-and-python/) – Dhvani Shah Mar 07 '18 at 04:59