lianglidong 发表于 2020-5-13 02:03:22

ffmpeg的overlay做画中画问题

现在有两个视频要做画中画,一个时长10分钟,一个时长10秒,我叠加完发现短的视频最后一帧被当做图片持续输出到视频,直到长视频结束,我现在的需求是,怎样让短视频在10秒处直接停止,输出完成。

孙悟空 发表于 2020-5-13 10:11:42

overlay=x=xxxx:y=xxxx:eof_action=endall

lianglidong 发表于 2020-5-13 10:18:44

ffmpeg-i input.mp4 -i sub.mp4   -filter_complexoverlay=x=320:y=240:eof_action=endalloutput1.mp4大师兄帮看下哪里问题

孙悟空 发表于 2020-5-13 11:58:28

(base) liuqi05:dash liuqi$ ffmpeg -v quiet -f lavfi -i testsrc2=s=1280x720:r=25 -t 10a.mp4
File 'a.mp4' already exists. Overwrite ? y
(base) liuqi05:dash liuqi$ ffmpeg -v quiet -f lavfi -i testsrc2=s=276x144:r=25 -t 5 -y b.mp4
(base) liuqi05:dash liuqi$ ./ffmpeg -hide_banner-i a.mp4 -i b.mp4   -filter_complexoverlay=x=320:y=240:eof_action=endalloutput1.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mp4':
Metadata:
    major_brand   : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
Duration: 00:00:10.00, start: 0.000000, bitrate: 2798 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 , 2795 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'b.mp4':
Metadata:
    major_brand   : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
Duration: 00:00:05.00, start: 0.000000, bitrate: 213 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 276x144 , 209 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
File 'output1.mp4' already exists. Overwrite? y
Stream mapping:
Stream #0:0 (h264) -> overlay:main
Stream #1:0 (h264) -> overlay:overlay
overlay -> Stream #0:0 (libx264)
Press to stop, [?] for help
using SAR=1/1
using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
profile High, level 3.1, 4:2:0, 8-bit
264 - core 159 r2991 1771b55 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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=18 lookahead_threads=3 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 'output1.mp4':
Metadata:
    major_brand   : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 , q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.84.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=125 fps=0.0 q=-1.0 Lsize=    1739kB time=00:00:04.88 bitrate=2919.2kbits/s speed=6.44x
video:1737kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.129384%
frame I:1   Avg QP:18.93size: 28067
frame P:50    Avg QP:24.78size: 17228
frame B:74    Avg QP:29.74size: 12003
consecutive B-frames:7.2% 35.2% 19.2% 38.4%
mb II16..4: 41.0% 48.7% 10.3%
mb PI16..4:0.8%4.5%1.2%P16..4:8.2%4.6%2.5%0.0%0.0%    skip:78.2%
mb BI16..4:0.1%0.6%0.6%B16..8: 11.1%3.0%0.8%direct: 1.3%skip:82.5%L0:48.3% L1:42.9% BI: 8.7%
8x8 transform intra:60.5% inter:31.6%
coded y,uvDC,uvAC intra: 26.3% 37.8% 36.8% inter: 3.8% 7.9% 6.9%
i16 v,h,dc,p: 77% 20%2%1%
i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 13% 70%2%1%1%1%1%2%
i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 24% 32%5%3%3%4%4%5%
i8c dc,h,v,p: 73% 13% 11%4%
Weighted P-Frames: Y:0.0% UV:0.0%
ref P L0: 50.7%7.9% 26.6% 14.8%
ref B L0: 76.1% 19.7%4.2%
ref B L1: 96.9%3.1%
kb/s:2844.38
(base) liuqi05:dash liuqi$
页: [1]
查看完整版本: ffmpeg的overlay做画中画问题