带水印的 ffmpeg 质量

发布于 2024-12-29 13:47:23 字数 795 浏览 4 评论 0原文

我想用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

玩世 2025-01-05 13:47:23

使用选项“-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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文