视频画中画
ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex "[1:v]scale=480x320[test];[0:v][test]overlay=x=main_w-480:y=main_h-320[out]" -map "[out]" -map 0:a\? out.mp4
ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex "[1:v]scale=480x320[test];[0:v][test]overlay=x='if(gte(t,2),-w+(t-2)*20,NAN)':y=0[out]" -map "[out]" -map 0:a\? out.mp4
视频加文字
ffmpeg -i 1.mp4 -vf "drawtext=fontsize=100:fontfile=fonts/typeface.TTF:text='%{localtime\:%Y-%m-%d %H-%M-%S}':fontcolor=red:x=0:y=0" out.mp4
视频多宫格
ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 -filter_complex "nullsrc=size=640x480[base];[0:v]setpts=PTS-STARTPTS,scale=320x240[upperleft];[1:v]setpts=PTS-STARTPTS,scale=320x240[upperright];[2:v]setpts=PTS-STARTPTS,scale=320x240[lowerleft];[3:v]setpts=PTS-STARTPTS,scale=320x240[lowerright];[base][upperleft]overlay=shortest=1[tmpl];[tmpl][upperright]overlay=shortest=1:x=320[tmp2];[tmp2][lowerleft]overlay=shortest=1:y=240[tmp3];[tmp3][lowerright]overlay=shortest=1:x=320:y=240" -c:v libx264 output.flv
视频截图(按关键帧)
ffmpeg -i input.flv -vf "select='eq(pict_type,PICT_TYPE_I )'” -vsync vfr
thumb%04d.png
网友评论