Ubuntu 编译ffmpeg 踩坑(五)

在执行视频加水印的时候报错:Could not find codec parameters (Video: png)  

Failed to find any codec

fly@ubuntu:~/Flys$ ffmpeg -i paly.mp4 -vf "movie=./water.png [logo]; [in][logo] overlay=10:10 [out]" water.mp4
ffmpeg version 4.0.6 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/usr/local/ffmpeg --extra-cflags=-I/home/fly/usr/local/ffmpeg/include --extra-cflags=-I/home/fly/usr/local/ffmpeg/include --bindir=/home/fly/bin --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-shared --enable-pthreads
  WARNING: library configuration mismatch
  avutil      configuration: --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads
  avcodec     configuration: --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads
  avformat    configuration: --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads
  avdevice    configuration: --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads
  avfilter    configuration: --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads
  swscale     configuration: --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads
  swresample  configuration: --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads
  postproc    configuration: --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'paly.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42avc1
    creation_time   : 2010-02-09T01:55:39.000000Z
  Duration: 00:01:00.10, start: 0.000000, bitrate: 733 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 65 kb/s (default)
    Metadata:
      creation_time   : 2010-02-09T01:55:39.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360, 612 kb/s, 23.96 fps, 24 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2010-02-09T01:55:39.000000Z
      handler_name    : Apple Video Media Handler
    Stream #0:2(eng): Data: none (rtp  / 0x20707472), 45 kb/s
    Metadata:
      creation_time   : 2010-02-09T01:55:39.000000Z
      handler_name    : hint media handler
    Stream #0:3(eng): Data: none (rtp  / 0x20707472), 5 kb/s
    Metadata:
      creation_time   : 2010-02-09T01:55:39.000000Z
      handler_name    : hint media handler
File 'water.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[png_pipe @ 0x559646c869c0] Could not find codec parameters for stream 0 (Video: png, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[Parsed_movie_0 @ 0x559646ab8c40] Failed to find any codec
[AVFilterGraph @ 0x559646ac3c00] Error initializing filter 'movie' with args './water.png'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:1
[aac @ 0x559646a20a40] Qavg: 38483.180
[aac @ 0x559646a20a40] 2 frames left in the queue on closing
Conversion failed!

 解决办法:重新编译,应该是在刚开始编译的时候少加了参数 --enable-decoder=png --enable-encoder=png 

参考:ffmpeg&png水印问题 - 程序园

在这里以为我之前的交叉编译导致编译失败,需要执行 make clean 后在重新编译即可成功

./configure --prefix=/usr/local/ffmpeg --enable-debug=3  --enable-shared  --disable-static --enable-gpl --enable-nonfree --enable-libfdk-aac  --enable-libx264 --enable-filter=delogo --disable-optimizations --enable-libspeex --enable-pthreads --enable-decoder=png --enable-encoder=png
make -j 4
sudo make install

再次执行加水印命令  

ffmpeg -i paly.mp4 -vf "movie=water.png,scale=64:64[wm];[in][wm]overlay=30:10[out]" water1.mp4

生成water1.mp4成功。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值