我正在尝试使用 FFmpeg 和 -vf 为视频添加水印以覆盖 PNG,但没有效果。
我的命令行:
$ffmpeg->exec('-i "' . $path_src . '" -vf "movie=watermark.png [wm]; [in][wm] overlay=0:0 [out]" -map_chapters -1:-1 -threads 2 -ar 44100 -ab 96k -vcodec libx264 -level 41 -crf 25 -bufsize 2000k -maxrate 2500k -r 25 -g 250 -s 720x480 ' . '-coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq \'blurCplx^(1-qComp)\' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -y "' . $path_dst . '"');
结果:
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers built on Dec 4 2010 15:37:20 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
[aac @ 0x81a54f0]Transition from an ONLY_LONG or LONG_STOP to an EIGHT_SHORT sequence detected. If you heard an audible artifact, please submit the sample to the FFmpeg developers.
Last message repeated 1 times
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/content/blabla.com/htdocs/setup/megaupload/upload/blabla/0001.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isom
Duration: 00:05:16.28, start: 0.000000, bitrate: 1598 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 1499 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 94 kb/s
Unrecognized option 'vf'"
答案1
您的 ffmpeg 版本(0.6.1/2010)有点旧,可能是因为自发布以来命令行格式已经发生了变化。
答案2
要在 ffmpeg 中为视频添加水印,你可以尝试这个教程。