0

Is there a way to watermark mp4/m4v files in PHP? The files are already saved on the server, but when displaying, I want a watermark to be put over through PHP (header-output).

Here is my current PHP code:

$fp = fopen($path, 'rb');

// Change the header to whatever your file's mime type is
header("Content-Type: " . $ctype);
header("Content-Length: " . filesize($path));

fpassthru($fp);
exit;
Bijan
  • 7,737
  • 18
  • 89
  • 149
  • You would likely need to pre-process the video(s) and add your watermark. – Jonathan Kuhn May 11 '15 at 19:52
  • Using exec and ffmpeg: http://stackoverflow.com/questions/19356963/adding-watermark-to-a-video-by-using-ffmpeg-in-php – maztch May 11 '15 at 20:13
  • Thanks. How would that be implemented into my code? See edit – Christian Bundgaard May 12 '15 at 07:04
  • Depending on the specs of the server and demand, re-encoding all files on the fly could be a timely process, optimally, you should pre-process the files as @JonathanKuhn suggested. Even if you were to save the files so that you ensured old videos weren't re-encoded you still have to put up with new files and the overhead on the server. Your question implies you would be OKAY with an overlay. Are my assumptions correct? – glend May 12 '15 at 07:15
  • I guess overlay is fine - it doesn't really matter - but it has to played in fullscreen. So a simple HTML overlay doesn't fit in here... but maybe some other video plugins will solve it, or what are you thinking? – Christian Bundgaard May 12 '15 at 08:31
  • I found a solution that works. http://stackoverflow.com/questions/16234740/overlay-on-html5-fullscreen-video – Christian Bundgaard May 12 '15 at 10:42

0 Answers0