ffmpeg& png水印问题

时间:2012-06-14 20:25:26

标签: ffmpeg png

我尝试在这样的视频上创建水印(使用png图片):

ffmpeg -i test.wmv -b:a 300k -ar 22050 -t 10 -f flv -s 352x288 -vf "movie = watermark_logo352.png [watermark]; [in][watermark] overlay =0:0 [out]" out.flv

但是我收到了错误:

ffmpeg version 0.10.4 Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 14 2012 13:14:31 with gcc 4.4.5   configuration:
--prefix=/home/username --enable-cross-compile --enable-shared --arch=amd64 --target-os=linux --disable-yasm --enable-decoder=png --enable-encoder=png   
        libavutil      51. 35.100 / 51. 35.100   
        libavcodec     53. 61.100 / 53. 61.100   
        libavformat    53. 32.100 / 53. 32.100   
        libavdevice    53.  4.100 / 53.  4.100   
        libavfilter     2. 61.100 /  2. 61.100   
        libswscale      2.  1.100 /  2.  1.100   
        libswresample   0.  6.100 /  0.  6.100 
        Input #0, asf, from 'test.wmv':   
        Metadata:
            >     WMFSDKVersion   : 9.00.00.2980
            >     WMFSDKNeeded    : 0.0.0.0000
            >     IsVBR           : 1
            >     VBR Peak        : 351
            >     Buffer Average  : 728   Duration: 00:00:05.59, start: 0.000000, bitrate: 574 kb/s
            >     Stream #0:0(jpn): Audio: wmav2 (a[1][0][0] / 0x0161), 22050 Hz, 2 channels, s16, 32 kb/s
            >     Stream #0:1(jpn): Video: wmv1 (WMV1 / 0x31564D57), yuv420p, 352x288, 520 kb/s, SAR 8:9 DAR 88:81, 29.97 tbr, 1k tbn, 1k tbc File
            > 'out2.flv' already exists. Overwrite ? [y/N] y w:352 h:288
            > pixfmt:yuv420p tb:1/1000000 sar:8/9 sws_param: 
    [image2 @ 0x551f880] decoding for stream 0 failed 
    [image2 @ 0x551f880] Could not find codec parameters (Video: png) 
    [movie @ 0x551f440] Failed to find stream info
    [movie @ 0x551f440] Failed to find any codec 
    Error initializing filter 'movie' with args 'watermark_logo352.png' 
    Error opening filters!

当我使用jpg时,它就像魅力一样。

我在Debian 6 Squeeze上使用ffmpeg v 0.10.4。 任何帮助将不胜感激。

修改

问题比我想象的要简单。如果我对任何png图像使用ffmpeg -i我会得到类似的错误:

  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
[image2 @ 0xc8b73a0] decoding for stream 0 failed
[image2 @ 0xc8b73a0] Could not find codec parameters (Video: png)
watermark.png: could not find codec parameters

2 个答案:

答案 0 :(得分:13)

看来你的编译没有zlib支持,这是PNG解码和编码的要求(参考FFmpeg configure文件的代码,看看还有什么需要它。)

对于Debian / Ubuntu,这意味着您需要 zlib1g-dev ,或者对于CentOS zlib-devel ,作为构建依赖项并重新编译FFmpeg。它由FFmpeg自动检测,因此您无需添加其他./configure参数,这意味着您也可以省略--enable-decoder=png --enable-encoder=png

FFmpeg compile guides上查看各种FFmpeg Wiki,或只是download a build of ffmpeg

答案 1 :(得分:1)

[watermark]替换为[wm],它就像一个魅力。 我用这个:

-vf "movie=0:png:./watermark.png [wm];[in][wm] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]"

(对于右下角水印)