FFMPEG -filter_complex drawtext的样式,如粗体斜体和下划线

时间:2017-11-02 11:13:24

标签: video ffmpeg video-processing

我正在尝试在视频的填充区域添加文字。有4到5件事我无法做到

  • 1)绘制文字样式(粗体,斜体,下划线)
  • 2)填充区域不透明度
  • 3)字幕垂直对齐。当我给VAlign一些价值时 有时会走出窗外。如何正确计算喜欢 顶部50px或者说底部200px
  • 4)字幕应为视频的全宽。现在就像 这个。 enter image description here
  • 5)很难提供OutlineColour值。我有RGBA 值得我如何将它赋予OutlineColour

这是我正在使用的命令

ffmpeg -y -i video-orignal.mp4 -i logo.png -filter_complex "[0] pad=width=iw:height=ih+200:x=0:y=100:color=#f2e6e6@0.99 [v_1];[v_1] drawtext=fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':text='this is watermark': fontsize=24: x=0.23333333333333*main_w: y=0.1325*main_h: fontcolor=#b01e1e: alpha=1,drawtext=fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':text='This is Top fixed text': fontsize=32: x=w-tw-2: y=(100-th)/2: fontcolor=#9e2643: alpha=1,drawtext=fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':text='This is Bottom fixed text': fontsize=32: x=w-tw-2: y=h-50: fontcolor=#9e2643: alpha=1 [v_2];[v_2] subtitles=f=subtitles-final.srt:force_style='FontName=DejaVu Sans Mono,FontSize=26,OutlineColour=&H00f2eded,PrimaryColour=&H000bf282,BorderStyle=3,WrapStyle=3,Bold=1,italic=1,Underline=1,Alignment=3,MarginV=86.4' [v_3];[v_3] [1]overlay=main_w-140:105 [v_4]" -map "[v_4]" -map 0:a video-final.mp4

分割成行并缩进以使其可读:

ffmpeg -y
-i video-orignal.mp4
-i logo.png
-filter_complex
    "[0] pad=width=iw:height=ih+200:x=0:y=100:color=#f2e6e6@0.99 [v_1];
    [v_1]
        drawtext=
            fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':
            text='this is watermark': fontsize=24:
            x=0.23333333333333*main_w: y=0.1325*main_h:
            fontcolor=#b01e1e: alpha=1,
        drawtext=
            fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':
            text='This is Top fixed text': fontsize=32:
            x=w-tw-2: y=(100-th)/2: fontcolor=#9e2643: alpha=1,
        drawtext=
            fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':
            text='This is Bottom fixed text': fontsize=32:
            x=w-tw-2: y=h-50: fontcolor=#9e2643: alpha=1
    [v_2];
    [v_2]
        subtitles=
            f=subtitles-final.srt:
            force_style=
                'FontName=DejaVu Sans Mono,
                FontSize=26,
                OutlineColour=&H00f2eded,
                PrimaryColour=&H000bf282,
                BorderStyle=3,WrapStyle=3,Bold=1,italic=1,Underline=1,
                Alignment=3,MarginV=86.4'
    [v_3];
    [v_3] [1]overlay=main_w-140:105 [v_4]"
-map "[v_4]"
-map 0:a
video-final.mp4

0 个答案:

没有答案