使用FFMPEG的乘法混合模式添加绿色叠加

时间:2014-03-25 10:30:44

标签: video ffmpeg

我目前正在开发一个需要视频编辑的项目。 这里我正在使用ffmpeg,它运行得很好,除了1个过滤器。 每个视频都应该使用Photoshop多重混合模式进行叠加。 我正在使用ffmpeg混合模式,但遗憾的是视频会在屏幕截图中看到绿色叠加。

原始图像 Original Image

用ffmpeg FFMPEG编辑


我想要实现的目标 Edited


这与我工作的模式有什么关系吗? 以下是我目前的代码

#!/bin/bash
vagrant ssh -c "./ffmpeg \
-i /vagrant/public/uploads/video/bw_RzWecVH02p.avi -i /vagrant/public/img/red_ellipse.png \
-filter_complex "blend=all_mode='multiply'" \
/vagrant/public/uploads/video/overlay_RzWecVH02p.mp4"


这是我的ffmpeg输出

$ overlay_edit.sh
ffmpeg version N-61445-gdded5ed Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar 14 2014 05:12:40 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/32bit --arch=x86_32 --extra-cflags
='-m32 -I/root/ffmpeg-static/32bit/include -static' --extra-ldflags='-m32 -L/roo
t/ffmpeg-static/32bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --en
able-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --e
nable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enabl
e-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --
enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enab
le-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 66.101 / 52. 66.101
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 34.101 / 55. 34.101
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, avi, from '/vagrant/public/uploads/video/bw_RzWecVH02p.avi':
  Metadata:
    comment         : Converted by www.scriptcam.com
    encoder         : Lavf55.34.101
  Duration: 00:00:06.10, start: 0.000000, bitrate: 315 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 320
x240 [SAR 1:1 DAR 4:3], 268 kb/s, 30 tbr, 30 tbn, 30 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 16000 Hz, mono, s16p, 24 kb/s

Input #1, image2, from '/vagrant/public/img/red_ellipse.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: png, rgb24, 320x240 [SAR 11811:11811 DAR 4:3], 25 tbr, 2
5 tbn, 25 tbc
[libx264 @ 0xa9c70c0] using SAR=1/1
[libx264 @ 0xa9c70c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle Ca
che64
[libx264 @ 0xa9c70c0] profile High, level 1.3
[libx264 @ 0xa9c70c0] 264 - core 129 r2230 1cffe9f - H.264/MPEG-4 AVC codec - Co
pyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 de
block=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1
me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chr
oma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scene
cut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin
=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/vagrant/public/uploads/video/overlay_RzWecVH02p.mp4':
  Metadata:
    comment         : Converted by www.scriptcam.com
    encoder         : Lavf55.34.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x24
0 [SAR 1:1 DAR 4:3], q=-1--1, 15360 tbn, 30 tbc (default)
    Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 16000 Hz, m
ono, s16, 128 kb/s
Stream mapping:
  Stream #0:0 (mpeg4) -> blend:top (graph 0)
  Stream #1:0 (png) -> blend:bottom (graph 0)
  blend (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (mp3 -> libvo_aacenc)
Press [q] to stop, [?] for help
frame=   91 fps=0.0 q=29.0 size=      42kB time=00:00:02.90 bitrate= 117.7kbits/
frame=  140 fps=135 q=29.0 size=     105kB time=00:00:04.57 bitrate= 187.3kbits/
frame=  182 fps=106 q=29.0 Lsize=     178kB time=00:00:06.04 bitrate= 241.9kbits
/s dup=52 drop=0
video:158kB audio:16kB subtitle:0 data:0 global headers:0kB muxing overhead 2.25
8588%
[libx264 @ 0xa9c70c0] frame I:1     Avg QP:21.21  size:  9865
[libx264 @ 0xa9c70c0] frame P:128   Avg QP:25.34  size:  1149
[libx264 @ 0xa9c70c0] frame B:53    Avg QP:28.50  size:    88
[libx264 @ 0xa9c70c0] consecutive B-frames: 59.3%  3.3%  6.6% 30.8%
[libx264 @ 0xa9c70c0] mb I  I16..4:  1.3% 69.3% 29.3%
[libx264 @ 0xa9c70c0] mb P  I16..4:  1.0%  5.8%  0.3%  P16..4: 35.1%  9.9%  5.6%
  0.0%  0.0%    skip:42.4%
[libx264 @ 0xa9c70c0] mb B  I16..4:  0.1%  0.4%  0.0%  B16..8: 11.8%  0.5%  0.1%
  direct: 0.1%  skip:86.9%  L0:48.6% L1:47.7% BI: 3.7%
[libx264 @ 0xa9c70c0] 8x8 transform intra:80.6% inter:80.1%
[libx264 @ 0xa9c70c0] coded y,uvDC,uvAC intra: 73.1% 14.6% 5.3% inter: 13.2% 2.4
% 0.4%
[libx264 @ 0xa9c70c0] i16 v,h,dc,p: 14% 49% 28%  9%
[libx264 @ 0xa9c70c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 28% 32%  4%  4%  4%  4%
  4%  6%
[libx264 @ 0xa9c70c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 30% 14%  5%  6%  8%  5%
  5%  6%
[libx264 @ 0xa9c70c0] i8c dc,h,v,p: 76% 13% 11%  1%
[libx264 @ 0xa9c70c0] Weighted P-Frames: Y:0.8% UV:0.0%
[libx264 @ 0xa9c70c0] ref P L0: 72.7% 16.4%  8.1%  2.8%  0.0%
[libx264 @ 0xa9c70c0] ref B L0: 84.7% 13.1%  2.1%
[libx264 @ 0xa9c70c0] ref B L1: 95.2%  4.8%
[libx264 @ 0xa9c70c0] kb/s:213.09
[libvo_aacenc @ 0xa9c82c0] 1 frames left in the queue on closing
Connection to 127.0.0.1 closed.

0 个答案:

没有答案