ffmpeg e vídeo transparente em bg estática

0

Estou tentando sobrepor um flv transparente sobre um png estático. Onde quer que eu veja, isso deve funcionar ... mas o resultado final é que o flv perde a transparência e, em vez disso, todas as áreas transparentes são preenchidas com branco quando a sobreposição é aplicada. Aqui está o que estou fazendo:

$ ffmpeg -y -loop 1 -i bg.png -i video.flv -filter_complex overlay=0:0 -shortest out.mp4

aqui está um link para uma pequena entrada flv:

link

ffmpeg started on 2014-11-06 at 17:17:04
Report written to "ffmpeg-20141106-171704.log"
Command line:
"C:\Program Files (x86)\BBoothRecorder\ffmpeg.exe" -y -loop 1 -i "C:\Program Files (x86)\BBoothRecorder\assets\images\beach1.png" -i "C:\Users\Jason\AppData\Roaming\BBoothRecorder\Local Store\output.flv" -filter_complex "overlay=0:0" -shortest -report "C:\Users\Jason\AppData\Roaming\BBoothRecorder\Local Store\output.mp4"
ffmpeg version N-62994-g2baf1c8 Copyright (c) 2000-2014 the FFmpeg developers
  built on May  5 2014 22:01:55 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 81.100 / 52. 81.100
  libavcodec     55. 60.103 / 55. 60.103
  libavformat    55. 37.102 / 55. 37.102
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, image2, from 'C:\Program Files (x86)\BBoothRecorder\assets\images\beach1.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0, 10, 1/25: Video: png, rgba, 640x480 [SAR 2834:2834 DAR 4:3], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, flv, from 'C:\Users\Jason\AppData\Roaming\BBoothRecorder\Local Store\output.flv':
  Metadata:
    canSeekToEnd    : true
    metadatacreator : Songstagram Desktop Encoder
    encoder         : Lavf55.37.102
  Duration: 00:00:03.36, start: 0.000000, bitrate: 658 kb/s
    Stream #1:0, 41, 1/1000: Video: flv1, yuv420p, 640x480, 200 kb/s, 14.99 fps, 14.99 tbr, 1k tbn, 1k tbc
    Stream #1:1, 104, 1/1000: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
[Parsed_overlay_0 @ 04bad080] Setting 'x' to value '0'
[Parsed_overlay_0 @ 04bad080] Setting 'y' to value '0'
[graph 0 input from stream 0:0 @ 04bc56e0] Setting 'video_size' to value '640x480'
[graph 0 input from stream 0:0 @ 04bc56e0] Setting 'pix_fmt' to value '28'
[graph 0 input from stream 0:0 @ 04bc56e0] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 04bc56e0] Setting 'pixel_aspect' to value '2834/2834'
[graph 0 input from stream 0:0 @ 04bc56e0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 04bc56e0] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 04bc56e0] w:640 h:480 pixfmt:rgba tb:1/25 fr:25/1 sar:2834/2834 sws_param:flags=2
[graph 0 input from stream 1:0 @ 04bc1a80] Setting 'video_size' to value '640x480'
[graph 0 input from stream 1:0 @ 04bc1a80] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 1:0 @ 04bc1a80] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 1:0 @ 04bc1a80] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 1:0 @ 04bc1a80] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 1:0 @ 04bc1a80] Setting 'frame_rate' to value '15000/1001'
[graph 0 input from stream 1:0 @ 04bc1a80] w:640 h:480 pixfmt:yuv420p tb:1/1000 fr:15000/1001 sar:0/1 sws_param:flags=2
[format @ 04bd8c80] compat: called with args=[yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16]
[format @ 04bd8c80] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16'
Successfully opened the file.
[auto-inserted scaler 0 @ 04362800] w:iw h:ih flags:'bilinear' interl:0
[Parsed_overlay_0 @ 04bad080] auto-inserting filter 'auto-inserted scaler 0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_overlay_0'
[auto-inserted scaler 1 @ 04362d00] w:iw h:ih flags:'bilinear' interl:0
[Parsed_overlay_0 @ 04bad080] auto-inserting filter 'auto-inserted scaler 1' between the filter 'graph 0 input from stream 1:0' and the filter 'Parsed_overlay_0'
[AVFilterGraph @ 0445efa0] query_formats: 5 queried, 2 merged, 2 already done, 0 delayed
[auto-inserted scaler 0 @ 04362800] w:640 h:480 fmt:rgba sar:2834/2834 -> w:640 h:480 fmt:yuv420p sar:1/1 flags:0x2
[auto-inserted scaler 1 @ 04362d00] w:640 h:480 fmt:yuv420p sar:0/1 -> w:640 h:480 fmt:yuva420p sar:0/1 flags:0x2
[Parsed_overlay_0 @ 04bad080] main w:640 h:480 fmt:yuv420p overlay w:640 h:480 fmt:yuva420p eof_action:repeat
[Parsed_overlay_0 @ 04bad080] [framesync @ 04be55c8] Selected 1/1000 time base
[Parsed_overlay_0 @ 04bad080] [framesync @ 04be55c8] Sync level 2
[graph 1 input from stream 1:1 @ 04362880] Setting 'time_base' to value '1/44100'
[graph 1 input from stream 1:1 @ 04362880] Setting 'sample_rate' to value '44100'
[graph 1 input from stream 1:1 @ 04362880] Setting 'sample_fmt' to value 's16p'
[graph 1 input from stream 1:1 @ 04362880] Setting 'channel_layout' to value '0x3'
[graph 1 input from stream 1:1 @ 04362880] tb:1/44100 samplefmt:s16p samplerate:44100 chlayout:0x3
[audio format for output stream 0:1 @ 04362900] Setting 'sample_fmts' to value 's16'
[audio format for output stream 0:1 @ 04362900] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[audio format for output stream 0:1 @ 04362900] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'audio format for output stream 0:1'
[AVFilterGraph @ 04380100] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto-inserted resampler 0 @ 04362380] ch:2 chl:stereo fmt:s16p r:44100Hz -> ch:2 chl:stereo fmt:s16 r:44100Hz
[libx264 @ 0439e7c0] using mv_range_thread = 24
[libx264 @ 0439e7c0] using SAR=1/1
[libx264 @ 0439e7c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0439e7c0] profile High, level 3.0
[libx264 @ 0439e7c0] 264 - core 142 r2409 d6b4e63 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=12 lookahead_threads=2 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 'C:\Users\Jason\AppData\Roaming\BBoothRecorder\Local Store\output.mp4':
  Metadata:
    encoder         : Lavf55.37.102
    Stream #0:0, 0, 1/12800: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 12800 tbn, 25 tbc (default)
    Stream #0:1, 0, 1/44100: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s
Stream mapping:
  Stream #0:0 (png) -> overlay:main (graph 0)
  Stream #1:0 (flv) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #1:1 -> #0:1 (mp3 -> libvo_aacenc)
Press [q] to stop, [?] for help
[libx264 @ 0439e7c0] frame=   0 QP=27.56 NAL=3 Slice:I Poc:0   I:1200 P:0    SKIP:0    size=21457 bytes
[...]
[libx264 @ 0439e7c0] frame= 139 QP=20.59 NAL=2 Slice:B Poc:278 I:1    P:18   SKIP:1181 size=54 bytes
[libx264 @ 0439e7c0] frame= 140 QP=25.00 NAL=0 Slice:B Poc:276 I:0    P:8    SKIP:1192 size=30 bytes
[libx264 @ 0439e7c0] frame= 141 QP=25.00 NAL=0 Slice:B Poc:280 I:0    P:7    SKIP:1193 size=29 bytes
[libx264 @ 0439e7c0] frame= 142 QP=25.00 NAL=2 Slice:P Poc:284 I:0    P:0    SKIP:1200 size=26 bytes
[libvo_aacenc @ 04387a40] Trying to remove 320 more samples than there are in the queue
frame=  143 fps=0.0 q=-1.0 Lsize=     262kB time=00:00:05.64 bitrate= 381.0kbits/s    
[libx264 @ 0439e7c0] frame I:2     Avg QP:24.09  size: 17638
[libx264 @ 0439e7c0] frame P:50    Avg QP:20.14  size:  3007
[libx264 @ 0439e7c0] frame B:91    Avg QP:24.42  size:   251
[libx264 @ 0439e7c0] consecutive B-frames: 14.0%  2.8%  2.1% 81.1%
[libx264 @ 0439e7c0] mb I  I16..4: 22.1% 63.5% 14.5%
[libx264 @ 0439e7c0] mb P  I16..4:  2.0%  5.7%  0.2%  P16..4: 22.1%  5.4%  3.8%  0.0%  0.0%    skip:60.8%
[libx264 @ 0439e7c0] mb B  I16..4:  0.1%  0.2%  0.0%  B16..8: 17.2%  0.4%  0.0%  direct: 0.1%  skip:82.0%  L0:49.2% L1:49.5% BI: 1.3%
[libx264 @ 0439e7c0] 8x8 transform intra:69.5% inter:82.3%
[libx264 @ 0439e7c0] coded y,uvDC,uvAC intra: 52.1% 67.6% 19.3% inter: 3.6% 4.4% 0.3%
[libx264 @ 0439e7c0] i16 v,h,dc,p: 33% 37% 23%  7%
[libx264 @ 0439e7c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 21% 47%  3%  2%  2%  3%  2%  3%
[libx264 @ 0439e7c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 32% 14%  5%  6%  4%  7%  3%  5%
[libx264 @ 0439e7c0] i8c dc,h,v,p: 41% 27% 26%  5%
[libx264 @ 0439e7c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0439e7c0] ref P L0: 71.7%  6.1% 15.4%  6.7%
[libx264 @ 0439e7c0] ref B L0: 71.9% 20.6%  7.5%
[libx264 @ 0439e7c0] ref B L1: 92.0%  8.0%
[libx264 @ 0439e7c0] kb/s:291.59

o vídeo e o png são 640 x 480 e a sobreposição está funcionando (se eu alterar a sobreposição = 100: 100 ... posso ver a bg sendo colocada atrás do vídeo corretamente), mas a transparência é perdida na sobreposição de flv .

Saída não aparada do log:
link

    
por Jason Reeves 07.11.2014 / 01:28

0 respostas

Tags