TheDeanVanGreunen

awesome watermark fluent ffmpeg

Sep 10th, 2020
760
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function convert(input, output, callback) {
  2.   if (debug) {
  3.     console.log("CONVERTING");
  4.     console.log("IN: " + input);
  5.     console.log("OUT: " + output);
  6.   }
  7.   ffmpeg(input)
  8.     // Adding a logo watermark
  9.     .input("clipdrop_logo.png")
  10.     // Set the logo positions
  11.     .complexFilter([
  12.         "overlay=main_w-overlay_w-50:main_h-overlay_h-50",
  13.     ])
  14.     .outputOptions([
  15.       "-loglevel panic",
  16.       "-preset veryfast",
  17.       "-movflags faststart",
  18.       "-vf scale=-1:480",
  19.       "-c:v libx264",
  20.       "-crf 23",
  21.       "-c:a aac",
  22.       "-bitrate 2000000",
  23.       "-maxrate 2200000",
  24.       "-bufsize 1500000"
  25.     ])
  26.     .on("end", function () {
  27.       if (debug) {
  28.         console.log("conversion ended");
  29.       }
  30.       callback(null);
  31.     })
  32.     .on("error", function (err) {
  33.       if (debug) {
  34.         console.log("error x: ", err);
  35.       }
  36.       callback(err);
  37.     })
  38.     .saveToFile(output);
  39. }
RAW Paste Data