Imagem de sobreposição sempre ausente após 24 segundos

1

Estou tentando converter um arquivo mkv e adicionar um logotipo de marca d'água a ele, mas tentei várias instruções diferentes, mas sempre falta o logotipo após 24 segundos do vídeo.

Aqui está o meu código:

ffmpeg \
   -i RTed83e104ac4d98c46383630d733a3282.mkv \
   -i RT894ce44c6ba84eb98300566adae4e7bf.mka \
   -i logo_white.png \
   -filter_complex "[2] scale=120:18 [ovr1], [0:v][ovr1]overlay=10:452" \
   output.mp4

Por exemplo: link , você pode ver que a imagem desapareceu após 24 segundos.

O que estou fazendo de errado?

OUTPUT / LOGS :

ffmpeg \
  -i RTed83e104ac4d98c46383630d733a3282.mkv \
  -i RT894ce44c6ba84eb98300566adae4e7bf.mka \
  -i logo_white.png \
  -filter_complex "[2] scale=120:18 [ovr1], [0:v][ovr1]overlay=10:452" \
  output.mp4
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, matroska,webm, from 'RTed83e104ac4d98c46383630d733a3282.mkv':
  Metadata:
    encoder         : GStreamer matroskamux version 1.8.1.1
    creation_time   : 2018-02-13T18:16:31.000000Z
  Duration: 00:05:48.26, start: 1.456000, bitrate: 528 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      title           : Video
Input #1, matroska,webm, from 'RT894ce44c6ba84eb98300566adae4e7bf.mka':
  Metadata:
    encoder         : GStreamer matroskamux version 1.8.1.1
    creation_time   : 2018-02-13T18:16:31.000000Z
  Duration: 00:05:47.78, start: 1.421000, bitrate: 45 kb/s
    Stream #1:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : Audio
Input #2, png_pipe, from 'logo_white.png':
  Duration: N/A, bitrate: N/A
    Stream #2:0: Video: png, rgba(pc), 600x90, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  Stream #2:0 (png) -> scale (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #1:0 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fc62308c400] using SAR=1/1
[libx264 @ 0x7fc62308c400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fc62308c400] profile High, level 3.0
[libx264 @ 0x7fc62308c400] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=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 chroma_qp_offset=-2 threads=6 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 scenecut=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 'output.mp4':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      title           : Audio
      encoder         : Lavc57.107.100 aac
Past duration 0.609993 too large       0kB time=00:00:01.73 bitrate=   0.2kbits/s dup=7 drop=0 speed=3.43x
    Last message repeated 2 times
frame=10449 fps=152 q=-1.0 Lsize=   11658kB time=00:05:48.20 bitrate= 274.3kbits/s dup=151 drop=0 speed=5.06x
video:5860kB audio:5422kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.338063%
[libx264 @ 0x7fc62308c400] frame I:42    Avg QP:13.16  size: 32061
[libx264 @ 0x7fc62308c400] frame P:2657  Avg QP:18.79  size:  1347
[libx264 @ 0x7fc62308c400] frame B:7750  Avg QP:22.91  size:   138
[libx264 @ 0x7fc62308c400] consecutive B-frames:  0.9%  0.5%  0.5% 98.1%
[libx264 @ 0x7fc62308c400] mb I  I16..4: 13.1% 64.6% 22.3%
[libx264 @ 0x7fc62308c400] mb P  I16..4:  0.3%  0.7%  0.1%  P16..4: 10.4%  3.3%  1.7%  0.0%  0.0%    skip:83.5%
[libx264 @ 0x7fc62308c400] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  8.0%  0.1%  0.0%  direct: 0.0%  skip:91.7%  L0:41.7% L1:56.6% BI: 1.7%
[libx264 @ 0x7fc62308c400] 8x8 transform intra:63.1% inter:64.4%
[libx264 @ 0x7fc62308c400] coded y,uvDC,uvAC intra: 75.8% 77.6% 61.0% inter: 1.3% 2.0% 0.2%
[libx264 @ 0x7fc62308c400] i16 v,h,dc,p: 17% 13% 37% 33%
[libx264 @ 0x7fc62308c400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 17% 25%  5%  4%  4%  5%  6%  9%
[libx264 @ 0x7fc62308c400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 18% 17%  8%  5%  5%  5%  5%  7%
[libx264 @ 0x7fc62308c400] i8c dc,h,v,p: 57% 20% 18%  5%
[libx264 @ 0x7fc62308c400] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fc62308c400] ref P L0: 65.0%  9.6% 16.7%  8.8%
[libx264 @ 0x7fc62308c400] ref B L0: 85.7% 12.4%  1.9%
[libx264 @ 0x7fc62308c400] ref B L1: 93.5%  6.5%
[libx264 @ 0x7fc62308c400] kb/s:137.80
[aac @ 0x7fc623086600] Qavg: 5304.135
    
por Filipe Braganca 15.02.2018 / 23:10

2 respostas

0

As entradas de origem do WebRTC geralmente são desleixadas e podem alterar os parâmetros no meio do fluxo, resultando em surpresas. No seu caso, uma solução preguiçosa poderia ser fazer o loop da imagem de sobreposição:

ffmpeg \
  -i RTed83e104ac4d98c46383630d733a3282.mkv \
  -i RT894ce44c6ba84eb98300566adae4e7bf.mka \
  -loop 1 -i logo_white.png \
  -filter_complex "[2] scale=120:18 [ovr1], [0:v][ovr1]overlay=10:452:shortest=1" \
  output.mp4
    
por 16.02.2018 / 00:36
0

Eu consegui fazer o que estava procurando, mas tive que fazer isso em etapas. Eu acho que meu problema foi porque meus vídeos são da WebRTC como @LordNeckbeard explicado abaixo. Aqui está minha solução se alguém no futuro precisar:

# convert student video + audio
ffmpeg \
  -i RT0dcbc54f85d17eb6f7922f58f7b12079.mkv \
  -i RTb0ccec59e2119a15642b7cd772db843e.mka \
  student.mp4

# convert instructor video + audio
ffmpeg \
  -i RTed83e104ac4d98c46383630d733a3282.mkv \
  -i RT894ce44c6ba84eb98300566adae4e7bf.mka \
  instructor.mp4

# add watermark to instructor_video
ffmpeg \
  -i instructor.mp4 \
  -i logo_white.png \
  -filter_complex "[1] scale=120:18 [ovr1], [0:v][ovr1]overlay=10:452" \
  instructor_with_logo.mp4

# Final - Include student video
ffmpeg \
  -i instructor_with_logo.mp4 \
  -i student.mp4 \
  -filter_complex "[1:v]setpts=PTS-STARTPTS+24/TB[v1]; \
                   [v1] scale=120:90 [student], [0:v][student]overlay=510:380:enable='between(t,24,36)'" \
  final.mp4
    
por 17.02.2018 / 01:39

Tags