Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg & png watermark issue

Tags:

png

ffmpeg

I tried to create a watermark (using a png image) on a video like this:

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

but I get the error:

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!

When I use a jpg, it works like a charm.

I'm use ffmpeg v 0.10.4 on Debian 6 Squeeze. Any help would be much appreciated.

EDIT

The problem is simpler than i thought. If i use ffmpeg -i with any png image i get a similar error:

  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
like image 434
mindcast Avatar asked Jun 14 '12 20:06

mindcast


People also ask

Does VLC install FFmpeg?

VLC does not embed FFmpeg as a sort of slave binary used internally, as you possibly could suppose. Instead, both FFmpeg and VLC are using libavcodec , a library which implement what ffmpeg exposes through its command line interface.

Is FFmpeg safe?

Not really. There are security risks, especially if you allow arbitrary formats. FFmpeg supports a huge variety of formats, both popular and obscure, for video, audio, and images formats.

Why is FFmpeg so good?

FFmpeg is free, open-source and can handle a huge amount of different formats, much more than your average media application, or even your NLE/DAW. Some examples of FFmpeg's usage include: Compressing/transcoding audio or video files. Joining multiple audio/video files into a single file.


2 Answers

It appears your compiled without zlib support which is a requirement for PNG decoding and encoding (refer to the code of the FFmpeg configure file to see what else requires it).

For Debian/Ubuntu this means you need zlib1g-dev, or for CentOS zlib-devel, as a build dependency and re-compile FFmpeg. It is automatically detected by FFmpeg, so you won't need to add additional ./configure parameters meaning you can also omit --enable-decoder=png --enable-encoder=png.

See the various FFmpeg compile guides at the FFmpeg Wiki, or simply download a build of ffmpeg.

like image 186
llogan Avatar answered Nov 02 '22 23:11

llogan


replace [watermark] with [wm] and it works like a charm. I use this:

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

(for right bottom watermark)

like image 45
Anrdre Avatar answered Nov 03 '22 00:11

Anrdre