我正在尝试使用 ffmpeg 在 OSX 上添加具有透明背景的水印。
我正在使用这个命令:
ffmpeg -i test.mpg -vf "movie=stuff.png, scale=100:100 [watermark]; [in][watermark] overlay=main_w-overlay_w:main_h-overlay_h-10 [out]" out.mpg
我得到了这个:
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 12 2012 21:37:10 with clang 3.1 (tags/Apple/clang-318.0.54)
configuration: --prefix=/usr/local/Cellar/ffmpeg/0.11.1 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/clang --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-libvo-aacenc --disable-ffplay
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mpeg, from 'test.mpg':
Duration: 00:00:01.04, start: 1.000000, bitrate: 9106 kb/s
Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p, 640x480 [SAR 1:1 DAR 4:3], 104857 kb/s, 24 fps, 24 tbr, 90k tbn, 24 tbc
Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16, 128 kb/s
File 'out.mpg' already exists. Overwrite ? [y/N] y
w:640 h:480 pixfmt:yuv420p tb:1/90000 sar:1/1 sws_param:flags=2
[buffersink @ 0x7ff50bc1c3e0] No opaque field provided
[png @ 0x7ff50c038400] unsupported bit depth 16 and color type 4
[image2 @ 0x7ff50c044800] decoding for stream 0 failed
[image2 @ 0x7ff50c044800] Could not find codec parameters (Video: png, 640x480)
[movie @ 0x7ff50bc17200] Failed to find stream info
[movie @ 0x7ff50bc17200] seek_point:0 format_name:(null) file_name:stuff.png stream_index:0
[scale @ 0x7ff50bc178c0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_movie_0' and the filter 'Parsed_scale_1'
Impossible to convert between the formats supported by the filter 'Parsed_movie_0' and the filter 'auto-inserted scaler 0'
Error opening filters!
我以为我缺少 png 支持,我检查了 libpng 安装的自制软件,但结果表明 Apple 已经在 OSX 中包含了 png 支持。
我也做过
ffmpeg -codecs list | grep -i png
我在 ffmpeg 中确实有 PNG 支持:
DEV D png PNG (Portable Network Graphics) image