Adding watermark to a video by using ffmpeg in php

how to add watermark in video using php
video watermark php script
php-ffmpeg
ffmpeg watermark
add text to video php
add watermark to video javascript
ffmpeg command line watermark
watermark in php-ffmpeg

I created a video with group of images and mp3. But i want to add a watermark text to that video .i am using the below code to add the text.

exec('/usr/local/bin/ffmpeg -y -i output.mov -acodec libmp3lame -vcodec msmpeg4 \
-b:a 192k -b:v 1000k -ar 44100 \
-vf "drawtext=text=string1 string2 string3 string4 string5 string6 string7 :expansion=normal:fontfile=/usr/bin/DejaVuSerif-BoldItalic-webfont.ttf: y=0:x=h-(2*lh)-n: fontcolor=white: fontsize=40: box=1: boxcolor=0x00000000@1" \
-an IMG_0696.avi');

The issue with this is that the video file is creating with zero size. Can any one help me please. Or else Suggest me any other command to add watermark text to video. Thank you in advance...

ffmpeg -i movie.mp4 -i logo.png -filter_complex overlay output.mp4

Add overlay or watermark to video - PHP & FFmpeg, The php web script that I'm using allows the admin panel to add a url, pointing to an image, that will appear as a watermark on the video when it  You need to download and install FFmpeg in your system. After installation, you can also add it in your environmental PATH variable. We are going to create a PHP script that will input 2 files from user, one video where watermark should be placed and second is the overlay image which will be placed throughout the video. Creating layout

I am using php-ffmpeg [Below : Composer Json]:

{
    "require": {
        "php-ffmpeg/php-ffmpeg": "^0.6.1"
    }
}

and Using this php-ffmpeg library you can add watermark's using the following codes:

<?php

function processVideo($videoSource,$reqExtension, $watermark = "")
{
    $ffmpeg = FFMpeg\FFMpeg::create();

    $video = $ffmpeg->open($videoSource);

    $format = new FFMpeg\Format\Video\X264('libmp3lame', 'libx264');

    if (!empty($watermark))
    {
        $video  ->filters()
                ->watermark($watermark, array(
                    'position' => 'relative',
                    'top' => 25,
                    'right' => 50,
                ));
    }

    $format
    -> setKiloBitrate(1000)
    -> setAudioChannels(2)
    -> setAudioKiloBitrate(256);

    $randomFileName = rand().".$reqExtension";
    $saveLocation = getcwd(). '/video/'.$randomFileName;
    $video->save($format, $saveLocation);

    if (file_exists($saveLocation))
        return "http://localhost/test/video/$randomFileName";
    else
        return "http://localhost/test/thumb/404.png";

}

echo $videoLocation =  processVideo("sample.mp4","mp4","favicon.png");

?>

[Please, update the location according to your need.]

Adding a watermark to a video via ffmpeg - PHP, It is important to display your brand logo along with your video. Also it serves as a material that this content has been provided by your brand. If  FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ff… You

Command:

    ffmpeg -i input.mp4 -i watermark.png -filter_complex 'overlay' output.mp4

Try this code in your controller.

  public function setWaterMark(Request $request_body){
      try {
        $watermark = Input::file('watermark');
        $input = Input::file('input');

        ffmpeg = "C:\\ffmpeg\\bin\\ffmpeg";
        $cmd = $ffmpeg . " -i " . $input . " -i " . $watermark . " -filter_complex 'overlay' " . $output_file;
        exec($cmd, $output);

        return $output_file;
  }

Add overlay or watermark to video - PHP & FFmpeg, I cannot find a way to extract the format from the video, as to pass it to save(), which . ffprobe and to use it so that I could do something like $video->save($​format, vendor/autoload.php'; $probe = FFMpeg\FFProbe::create();  The php web video script that Im using, has ffmpeg, and it uploads videos succesfully. Im trying to add the ability to add a watermark onto the video upon upload.

$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('video.mpg');
$video
    ->filters()
    ->resize(new FFMpeg\Coordinate\Dimension(320, 240))
    ->synchronize();
$video
    ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
    ->save('frame.jpg');
$video
    ->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4')
    ->save(new FFMpeg\Format\Video\WMV(), 'export-wmv.wmv')
    ->save(new FFMpeg\Format\Video\WebM(), 'export-webm.webm');

Steps for install FFmpeg on system. http://drupalasia.com/article/how-add-watermark-video-using-php-and-ffmpeg

Adding watermark and keep audio and video settings unchanged , FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay  Below is a sample of the command I am using: ffmpeg -i input.mkv -i image.png -filter_complex “overlay=W-w-25:H-h-25:enable=’lt(mod((t\),900),30)'” output.mkv. The above command places a watermark in the lower right corner for 30 seconds every 15 minutes. It just seems odd to me that the watermark would add that much to the overall size.

FFmpeg add a watermark to video · GitHub, I'd suggest using ffmpeg with php, please check To water mark videos at bottom right corner using ffmpeg. Let me know if you can make it working. Upvote if  If you are using an ad blocker addon, you should to disable it (it blocks more than ads and causes parts of the site to not work). use ffmpeg slice, add watermark and converting at once in PHP Discussion in ' Programming ' started by vOlLvEriNe, Nov 14, 2016. 0

How to add a company logo as a watermark in a video using PHP or , Watermarking Videos from the Command Line with FFMPEG Filters Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an I use this code on php using php exec. The web video script that Im using, and trying to modify, works successfully integrating a watermark in the upper left corner of the video file, (so that when its downloaded, the watermark stays on the video).

Watermarking Videos from the Command Line with FFMPEG Filters , We want to add a our banner image at the start of the videos or add our logo in a corner of videos. We use ffmpeg to convert videos and think we  See the documentation on the overlay video filter for more information and examples. See the FFmpeg H.264 Video Encoding Guide for more information on getting a good quality output. If your image being overlaid is RGB colorspace (such as most PNG images) you may see a visual improvement if you add format=rbg to your overlay.

Comments
  • Does that command at the console work?
  • I am not sure, but its working fine in php.
  • Not sure I am with you. If it is working in PHP, what's the question? :)
  • that command to creating video with 0 size.I am not sure that will work in console because i haven't tried in console.
  • So, not working in PHP then. OK, at the risk of stating the obvious, try it on the console?