0

So, I've been searching around for quite some time without finding any answers.

Goal: Compress video for quick uploading to a server, while keeping the added watermark overlay crisp.

Problem: When I compress the video, using SDAVAssetExportsession (https://github.com/rs/SDAVAssetExportSession), the video nicely compresses but the watermark does as well resulting in a blurry, bad-looking overlay.

Anybody got any suggestions? Thanks!

trdavidson
  • 1,051
  • 12
  • 25

1 Answers1

1

Watermarks are inherently hard to compress, because they typically:

  • Contain sharp edges, which are difficult to compress without ringing artifacts.
  • Do not move with the rest of the image, confusing motion compensation algorithms.
  • Obscure part of the image, requiring data involving content that was covered by the watermark to be reencoded if it reappears.

That being said, there are some steps you can take to make your watermark easier to compress:

  • Make your watermark fully opaque. Do not use a partially translucent watermark. This allows the content of the watermarked area to be stored as a "constant" in the video, rather than requiring it to be updated frequently. (As an additional benefit, this also makes it more difficult to remove.)
  • Give your watermark a simple outline, ideally a rectangle. Complex outlines increase the frequency with which data will appear and disappear behind the watermark.
  • Position it on 16x16 pixel boundaries in the frame of the output video. Many video compression algorithms use 8x8 or 16x16 blocks, so aligning your watermark to these boundaries will help keep it separate from other parts of the video.

If all else fails, consider increasing the compression quality for your video, or applying the watermark on the server side after the video is uploaded.

  • First, thanks for getting back to me so quickly and your elaborate response. The watermark in question is a partially translucent black background with white solid text in it, similar to what you would see on the app Snapchat. I thought about killing the translucent part but decided against it as it looks quit bad unfortunately. My second thought was: would it make sense/is there a way to first compress the video, and THEN add the watermark afterwards? I'm extremely puzzled by how Snapchat is able to achieve this without blowing up their video to epic proportions - any additional thoughts? – trdavidson Apr 15 '16 at 00:43
  • I haven't actually used Snapchat, so no, I don't actually know what you're referring to. That being said: Is it possible that Snapchat is applying the watermark as an overlay in the application, rather than embedding it in the video at all? –  Apr 15 '16 at 00:57
  • So, at first I made this assumption as well, but the fact that you can immediately save the video down without loss of quality in the watermark shows otherwise..very frustrating indeed! – trdavidson Apr 15 '16 at 01:05