i want to add a watermark to a video with ffmpeg. At this time nearly all things are computing properly, except the quality of the new video is massively lower than in the one of the original video.
I also use ffmpeg-php and tried to set the minrate to the Bitrate of the original, but then i get an Error. Code seems like this at the moment.
$video = new ffmpeg_movie('hot_wheels_for_adults.flv');
$watermark = 'path/to/watermark.png';
$width = $video->getFrameWidth();
$height = $video->getFrameHeight();
$exec = 'ffmpeg -i hot_wheels_for_adults.flv ' .
'-y -vf "movie=' . $watermark . ' ' .
'[watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" ' .
'-f flv -s ' . $width . 'x' . $height . ' ' .
'-minrate ' . $video->getBitRate() . ' ' .
'bla2.flv';
Thats it. Without the '-minrate' line the quality isnt good. Originalrate = 630615, Rate of new Video = 328000.
With the '-sameq' flag i got a good quality, but it is raised from 6,5MB to nearly 30MB...
What can i do now?
Use the option "-qscale n" where "n" is between 1 (best quality) and 31 (worst quality). Might be different depending on your version of ffmpeg.