ffmpeg DrawText

ffmpeg -i F:/Temp/input.mov -y -vf "[in]drawtext=fontfile=HanYiYanKaiW-2.ttf:text='Frame\:%{n}':start_number=100:x=(w-text_w)/2:y=(h-text_h)/2:fontsize=80:fontcolor=red, drawtext=text='%{pts\:hms}':x=0:y=0:fontsize=80:fontcolor=red,  drawtext=fontfile=HanYiYanKaiW-2.ttf:text='TOPCENTER':x=(w-text_w)/2:y=0:fontsize=80:fontcolor=red,  drawtext=text='TOPRIGHT':x=w-tw:y=0:fontsize=80:fontcolor=red,  drawtext=text='BOTLEFT':x=0:y=h-th:fontsize=80:fontcolor=red,  drawtext=text='BOTCENTER':x=(w-text_w)/2:y=h-th:fontsize=80:fontcolor=red,  drawtext=text='BOTRIGHT':x=w-tw:y=h-th:fontsize=80:fontcolor=red"   -c:a copy  F:/Temp/output.mov

ffmpeg -i F:/Temp/input.mov -y -vf “[in]drawtext=fontfile=HanYiYanKaiW-2.ttf:text=‘Frame:%{n}’:start_number=100:x=(w-text_w)/2:y=(h-text_h)/2:fontsize=80:fontcolor=red, drawtext=text=‘%{pts:hms}’:x=0:y=0:fontsize=80:fontcolor=red, drawtext=fontfile=HanYiYanKaiW-2.ttf:text=‘TOPCENTER’:x=(w-text_w)/2:y=0:fontsize=80:fontcolor=red, drawtext=text=‘TOPRIGHT’:x=w-tw:y=0:fontsize=80:fontcolor=red, drawtext=text=‘BOTLEFT’:x=0:y=h-th:fontsize=80:fontcolor=red, drawtext=text=‘BOTCENTER’:x=(w-text_w)/2:y=h-th:fontsize=80:fontcolor=red, drawtext=text=‘BOTRIGHT’:x=w-tw:y=h-th:fontsize=80:fontcolor=red” -c:a copy F:/Temp/output.mov

  • [in] 将多条drawtext 集合到一起,并且使用逗号分割
  • -y 将需要确认的操作,一律确认为yes
  • start_number, 是相对于 n或frame_num 的开始帧数. 默认值为 “0”.
  • %{pts:hms},时间码,精确到毫秒

位置参数

CENTER

x=(w-text_w)/2:y=(h-text_h)/2

TOP LEFT

x=0:y=0 (with 10 pixel padding x=10:y=10)

TOP CENTER

x=(w-text_w)/2:y=0 (with 10 px padding x=(w-text_w)/2:y=10)

TOP RIGHT

x=w-tw:y=0 (with 10 px padding: x=w-tw-10:y=10)

BOTTOM LEFT

x=0:y=h-th (with 10 px padding: x=10:y=h-th-10)

Bottom CENTER

x=(w-text_w)/2:y=h-th (with 10 px padding: x=(w-text_w)/2:y=h-th-10)

Bottom RIGHT

x=w-tw:y=h-th (with 10 px padding: x=w-tw-10:y=h-th-10)

参考链接
1.ffmpeg filters

你可能感兴趣的:(ffmpeg,python)