ffmpeg overlay filter:保持音频和视频质量

时间:2018-04-30 14:43:07

标签: video ffmpeg watermark video-watermarking

我使用ffmpeg overlay filter为视频添加水印,我想保留视频的原始质量。这是原始视频的ffmpeg -i输出:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'original_recording.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.25.100
  Duration: 00:03:59.13, start: 0.000000, bitrate: 1932 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1472x828 [SAR 1:1 DAR 16:9], 1796 kb/s, 24.96 fps, 25 tbr, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

这是我用来在右下角覆盖图像文件的命令(基本上是水印):

ffmpeg -i original_recording.mp4 -i watermark.png -filter_complex "overlay=W-w-45:H-h-35" -c:v libx264 -strict -2 output.mp4

我添加了libx264选项,因为输出全部都是wibbly。但是,当我使用它时,输出文件的大小远小于原始文件。 (播放视频时,质量没有明显下降,但如果可能的话,我宁可不要失去质量)。我非常不是视频格式的专家,说实话我有点迷失。

我已尝试过-crf选项,但会出现此错误消息:

Codec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (output.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

将图像叠加为水印的最佳方法是什么,同时尽可能保留原始视频的质量?

0 个答案:

没有答案