I have a CMS system for uploading videos using ffmpeg, I cannot figure a way to watermark the videos every time I'm getting errors (video cannot play) or error encoding etc. The command for processing the videos is:
$shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=426:-2 -crf 26 $video_output_full_path_240 2>&1");
I have tried this command also:
$shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=426:-2 -crf 26 -i watermark.png -filter_complex 'overlay=10:10' $video_output_full_path_240 2>&1");
This not seems to work.. is there any way I can troubleshoot this ?
If you were to refer to the output from ffmpeg
you would encounter two errors:
Option filter:v
(set stream filtergraph) cannot be applied to input url watermark.png
-- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. Error parsing options for input file watermark.png
.
Filtergraph 'scale=426:-2'
was specified through the -vf
/ -af
/ -filter
option for output stream 0:0, which is fed from a complex filtergraph. -vf
/ -af
/ -filter
and -filter_complex
cannot be used together for the same stream.
ffmpeg [global options] [input0 options] -i input0 [input1 options] -i input1 [output options] output
-vf
and -filter_complex
. Do all filtering in one -filter_complex
instance.ffmpeg -i video.mp4 -i watermark.png -filter_complex "[0]scale=426:-2[bg];[bg][1]overlay=10:10" -c:v libx264 -preset fast -crf 26 output.mp4
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.