1

Привет, может кто-нибудь сказать мне, как изменить этот код, чтобы наложение автоматически стало полноэкранным?

ffmpeg -y -i movie.mp4 -i filter.png -af "[0:a]atempo=1.15,volume=1.6,pan=stereo|c0<c0+0*c1|c1<c0+0*c1,aeval=val(0)|-val(1)" -filter_complex "[0:v]setpts=PTS/1.15,crop=iw/1.2:ih/1.2,boxblur=1:2,scale=1280:720 [v1]; [v1][1:v]overlay=0:0,setdar=16/9" -vcodec libx264 -pix_fmt yuv420p -r 30 -g 60 -b:v 1400k -profile:v main -level 3.1 -acodec libmp3lame -b:a 128k -ar 44100 -metadata title="" -metadata artist="" -metadata album_artist="" -metadata album="" -metadata date="" -metadata track="" -metadata genre="" -metadata publisher="" -metadata encoded_by="" -metadata copyright="" -metadata composer="" -metadata performer="" -metadata TIT1="" -metadata TIT3="" -metadata disc="" -metadata TKEY="" -metadata TBPM="" -metadata language="eng" -metadata encoder="" -threads 0 -preset superfast movie-new.mp4

Ниже приведен полный журнал, который корректно обрабатывает видео с использованием решения cyans, но звук, похоже, удален.

ffmpeg -y -i movie.mp4 -i filter.png -af "[0:a]atempo=1.15,volume=1.6,pan=stereo|c0<c0+0*c1|c1<c0+0*c1,aeval=val(0)|-val(1)" -filter_complex "[0:v]setpts=PTS/1.15,crop=iw/1.2:ih/1.2,boxblur=1:2,scale=1280:720[v1];[1:v][v1]scale2ref[wm][v1];[v1][wm]overlay=0:0,setdar=16/9" -vcodec libx264 -pix_fmt yuv420p -r 30 -g 60 -b:v 1400k -profile:v main -level 3.1 -acodec libmp3lame -b:a 128k -ar 44100 -metadata title="" -metadata artist="" -metadata album_artist="" -metadata album="" -metadata date="" -metadata track="" -metadata genre="" -metadata publisher="" -metadata encoded_by="" -metadata copyright="" -metadata composer="" -metadata performer="" -metadata TIT1="" -metadata TIT3="" -metadata disc="" -metadata TKEY="" -metadata TBPM="" -metadata language="eng" -metadata encoder="" -threads 0 -preset superfast movie-new.mp4
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --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-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2018-04-25 14:39:26
  Duration: 00:01:35.36, start: 0.000000, bitrate: 1178 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x536 [SAR 1:1 DAR 160:67], 1047 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      creation_time   : 2018-04-25 14:39:26
      handler_name    : ISO Media file produced by Google Inc. Created on: 04/25/2018.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-04-25 14:39:26
      handler_name    : ISO Media file produced by Google Inc. Created on: 04/25/2018.
Input #1, png_pipe, from 'filter.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, pal8(pc), 460x250, 25 tbr, 25 tbn, 25 tbc
[Parsed_pan_2 @ 0x1987a80] Pure channel mapping detected: 0 0
[libx264 @ 0x18c3220] using SAR=1/1
[libx264 @ 0x18c3220] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX LZCNT
[libx264 @ 0x18c3220] profile Main, level 3.1
[libx264 @ 0x18c3220] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x1 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 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=1 keyint=60 keyint_min=6 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=1400 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 pb_ratio=1.30 aq=1:1.00
Output #0, mp4, to 'Jurassic-World-Fallen-Kingdom-Super-Bowl-Trailer-2018-newe.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 1400 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc56.60.100 libx264
    Stream #0:1(und): Audio: mp3 (libmp3lame) (i[0][0][0] / 0x0069), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-04-25 14:39:26
      handler_name    : ISO Media file produced by Google Inc. Created on: 04/25/2018.
      encoder         : Lavc56.60.100 libmp3lame
Stream mapping:
  Stream #0:0 (h264) -> setpts (graph 0)
  Stream #1:0 (png) -> scale2ref:default (graph 0)
  setdar (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Past duration 0.604988 too large     494kB time=00:00:02.60 bitrate=1556.0kbits/s dup=7 drop=0
Past duration 0.611244 too large     626kB time=00:00:03.56 bitrate=1438.4kbits/s dup=9 drop=0
Past duration 0.606239 too large    1490kB time=00:00:08.13 bitrate=1500.8kbits/s dup=20 drop=0
Past duration 0.612495 too large    1674kB time=00:00:08.96 bitrate=1529.3kbits/s dup=22 drop=0
Past duration 0.607491 too large    2584kB time=00:00:13.66 bitrate=1548.9kbits/s dup=34 drop=0
Past duration 0.601250 too large    3420kB time=00:00:18.16 bitrate=1542.2kbits/s dup=45 drop=0
Past duration 0.608742 too large    3776kB time=00:00:19.76 bitrate=1564.8kbits/s dup=49 drop=0
Past duration 0.602486 too large    4795kB time=00:00:24.26 bitrate=1618.4kbits/s dup=59 drop=0
Past duration 0.608742 too large    4914kB time=00:00:25.23 bitrate=1595.3kbits/s dup=62 drop=0
Past duration 0.603737 too large    5522kB time=00:00:29.43 bitrate=1536.9kbits/s dup=72 drop=0
Past duration 0.609993 too large    5828kB time=00:00:31.56 bitrate=1512.5kbits/s dup=77 drop=0
Past duration 0.604988 too large    6840kB time=00:00:35.83 bitrate=1563.6kbits/s dup=88 drop=0
Past duration 0.611244 too large    7003kB time=00:00:36.76 bitrate=1560.4kbits/s dup=90 drop=0
Past duration 0.606239 too large    8098kB time=00:00:41.50 bitrate=1598.5kbits/s dup=101 drop=0
Past duration 0.612495 too large    8535kB time=00:00:43.16 bitrate=1619.8kbits/s dup=105 drop=0
Past duration 0.607491 too large    9154kB time=00:00:47.23 bitrate=1587.6kbits/s dup=115 drop=0
Past duration 0.601250 too large   10211kB time=00:00:51.77 bitrate=1615.6kbits/s dup=126 drop=0
Past duration 0.608742 too large   10594kB time=00:00:53.53 bitrate=1621.2kbits/s dup=131 drop=0
Past duration 0.602486 too large   11301kB time=00:00:57.56 bitrate=1608.2kbits/s dup=140 drop=0
Past duration 0.608742 too large   11434kB time=00:00:58.60 bitrate=1598.5kbits/s dup=143 drop=0
Past duration 0.603737 too large   12007kB time=00:01:02.70 bitrate=1568.8kbits/s dup=153 drop=0
Past duration 0.609993 too large   12327kB time=00:01:04.76 bitrate=1559.1kbits/s dup=158 drop=0
Past duration 0.604988 too large   13526kB time=00:01:09.30 bitrate=1599.0kbits/s dup=169 drop=0
Past duration 0.611244 too large   13629kB time=00:01:10.43 bitrate=1585.2kbits/s dup=172 drop=0
Past duration 0.606239 too large   14169kB time=00:01:14.66 bitrate=1554.5kbits/s dup=182 drop=0
Past duration 0.612495 too large   14313kB time=00:01:15.60 bitrate=1551.0kbits/s dup=184 drop=0
Past duration 0.607491 too large   14839kB time=00:01:20.20 bitrate=1515.8kbits/s dup=195 drop=0
frame= 2487 fps= 57 q=24.0 Lsize=   15227kB time=00:01:22.93 bitrate=1504.0kbits/s dup=201 drop=0
video:13857kB audio:1296kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.488707%
[libx264 @ 0x18c3220] frame I:95    Avg QP:16.87  size: 22763
[libx264 @ 0x18c3220] frame P:1289  Avg QP:17.98  size:  7722
[libx264 @ 0x18c3220] frame B:1103  Avg QP:19.85  size:  1878
[libx264 @ 0x18c3220] consecutive B-frames: 31.0% 26.1% 10.0% 32.8%
[libx264 @ 0x18c3220] mb I  I16..4: 46.3%  0.0% 53.7%
[libx264 @ 0x18c3220] mb P  I16..4: 19.8%  0.0%  4.0%  P16..4: 41.2%  0.0%  0.0%  0.0%  0.0%    skip:35.1%
[libx264 @ 0x18c3220] mb B  I16..4:  1.4%  0.0%  0.1%  B16..8: 16.2%  0.0%  0.0%  direct: 4.7%  skip:77.5%  L0:37.1% L1:56.2% BI: 6.8%
[libx264 @ 0x18c3220] final ratefactor: 25.35
[libx264 @ 0x18c3220] coded y,uvDC,uvAC intra: 15.6% 28.4% 4.8% inter: 5.2% 12.2% 0.0%
[libx264 @ 0x18c3220] i16 v,h,dc,p: 56% 24% 10% 10%
[libx264 @ 0x18c3220] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 20% 23%  6%  4%  5%  4%  4%  3%
[libx264 @ 0x18c3220] i8c dc,h,v,p: 57% 15% 20%  8%
[libx264 @ 0x18c3220] Weighted P-Frames: Y:15.6% UV:7.8%
[libx264 @ 0x18c3220] kb/s:1369.22
vagrant@ubuntu-xenial:/workspace/www/build/videos$

Спасибо Даниэль

1 ответ1

1

Используйте фильтр scale2ref,

-filter_complex
      "[0:v]setpts=PTS/1.15,crop=iw/1.2:ih/1.2,boxblur=1:2,scale=1280:720 [v1];
       [1:v][v1]scale2ref[wm][v1];[v1][wm]overlay=0:0,setdar=16/9"

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .