Adding watermark to a video by using ffmpeg in php

前端 未结 4 855
心在旅途
心在旅途 2020-12-18 16:10

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/loca         


        
4条回答
  •  借酒劲吻你
    2020-12-18 16:28

    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;
      }
    

提交回复
热议问题