Example #1
0
        /// <summary>
        /// Watermark a video
        /// </summary>
        /// <param name="input"></param>
        /// <param name="output"></param>
        /// <param name="watermark"></param>
        /// <param name="beforeInput"></param>
        /// <param name="beforeOutput"></param>
        /// <returns></returns>
        public static async Task <bool> WatermarkAsync(string input, string output, Watermark watermark,
                                                       Dictionary <string, string> beforeInput  = null,
                                                       Dictionary <string, string> beforeOutput = null)
        {
            if (watermark != null)
            {
                beforeOutput        = beforeOutput ?? new Dictionary <string, string>();
                beforeOutput["-vf"] = watermark.Color == Color.Empty
                    ? $"'movie={watermark.Picture}[wm]; [in][wm]overlay={watermark.X}:{watermark.Y}[out]'"
                    : $"'movie={watermark.Picture},colorkey=0x{watermark.Color.ToArgb().ToString("X").Substring(2)}:{watermark.Similarity}:{watermark.Blend} [wm]; [in][wm]overlay={watermark.X}:{watermark.Y}[out]'";
            }

            return(await ExecuteFfmpegAsync(input, output, beforeInput, beforeOutput));
        }