使用ffmpeg添加不透明的覆盖 [英] using ffmpeg to add overlay with opacity

查看:611
本文介绍了使用ffmpeg添加不透明的覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对ffmpeg有问题,我尝试在视频上添加png文件,我发现了如何添加,只是我希望此png文件具有一定的不透明度 我尝试了这一行

I have a problem with ffmpeg,I try to add a png files over a video i found how to add just I want this png file have some opacity I tryed this line

ffmpeg -n -i video.mp4 -i logo.png -filter_complex "setsar=sar=1;blend=all_mode='overlay':all_opacity=0.7" -movflags +faststart tmb/video.mp4

在这行ffmpeg中返回此错误

with this line ffmpeg return this error

Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_blend_1

还有完整的日志

ffmpeg version 2.7.5-0ubuntu0.15.10.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
  configuration: --prefix=/usr --extra-version=0ubuntu0.15.10.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-openal --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr --enable-libx264 --enable-libopencv --enable-libx265
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.59.106
  Duration: 00:06:17.68, start: 0.023220, bitrate: 1660 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x720 [SAR 8:9 DAR 4:3], 1527 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, png_pipe, from 'logo.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 1080x720 [SAR 3780:3780 DAR 3:2], 25 tbr, 25 tbn, 25 tbc
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_blend_1

我对ffmpeg有点傻,我试图用google找到解决方案,但找不到.

I'm a little noob with ffmpeg and I tryed to find a solution with google and don't find.

没有setsar = sar = 1,我得到了关于两个不同的sar的错误

Without setsar=sar=1 I got the error about two different sar

[Parsed_blend_0 @ 0x14bb0e0] First input link top parameters (size 1080x720, SAR 8:9) do not match the corresponding second input link bottom parameters (1080x720, SAR 1:1)
[Parsed_blend_0 @ 0x14bb0e0] Failed to configure output pad on Parsed_blend_0

感谢您的帮助

推荐答案

尝试

ffmpeg -n -i video.mp4 -i logo.png -filter_complex "[0:v]setsar=sar=1[v];[v][1]blend=all_mode='overlay':all_opacity=0.7" -movflags +faststart tmb/video.mp4

这篇关于使用ffmpeg添加不透明的覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆