带水印的 ffmpeg 质量
我想用 ffmpeg 给视频添加水印。此时,几乎所有事情都可以正常计算,只是新视频的质量大大低于原始视频的质量。
我还使用 ffmpeg-php 并尝试将 minrate 设置为原始比特率,但随后出现错误。目前代码看起来像这样。
$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';
就是这样。如果没有“-minrate”行,质量就不好。 原价 = 630615, 新视频的速率 = 328000。
使用“-sameq”标志,我获得了良好的质量,但它从 6,5MB 提高到近 30MB...
我现在能做什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用选项“-qscale n”,其中“n”介于 1(最佳质量)和 31(最差质量)之间。
根据您的 ffmpeg 版本可能会有所不同。
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.