ffmpeg subtitles alignment and position

后端 未结 3 1837
一向
一向 2021-02-09 05:02

I am adding subtitles to a video using:

ffmpeg -i \"imput.mp4\" -lavfi \"subtitles=subtitles.srt:force_style=\'OutlineColour=&H100000000,BorderStyle=3,Outlin         


        
相关标签:
3条回答
  • 2021-02-09 05:48

    Turns out the trick for doing this is to add Alignment=0. Then you can use MarginV and MarginL freely:

    ffmpeg -i "imput.mp4" -lavfi "subtitles=subtitles.srt:force_style='Alignment=0,OutlineColour=&H100000000,BorderStyle=3,Outline=1,Shadow=0,Fontsize=18,MarginL=5,MarginV=25'" -crf 1 -c:a copy "output.mp4"
    
    0 讨论(0)
  • 2021-02-09 05:51

    I try to small size the text and turn the margin of bottom: Alignment=2, Fontsize = 5, MarginV = 1 It's work for me. like this way:

    ffmpeg -i "1.mkv" -lavfi "subtitles=1.srt:force_style='Alignment=2,OutlineColour=&H100000000,BorderStyle=3,Outline=1,Shadow=0,Fontsize= 12,MarginV=35'" -crf 1 -c:a copy  -vcodec h264_nvenc  "output.mkv"
    

    *-vcodec h264_nvenc is cuda accelerator.

    0 讨论(0)
  • 2021-02-09 05:55

    in fact you can also put some margin like "MarginV=20" in order to teweak position of subtitles

    ffmpeg2 -y -i "C:\Users\input.mxf" -pix_fmt yuv422p -vcodec mpeg2video -non_linear_quant 1 -flags +ildct+ilme -top 1 -dc 10 -intra_vlc 1 -qmax 6 -lmin "1*QP2LAMBDA" -vtag xd5c -rc_max_vbv_use 1 -rc_min_vbv_use 1 -g 12 -b:v 50000k -minrate 50000k -maxrate 51000k -bufsize 8000k -color_primaries 1 -color_trc 1 -colorspace 1 -vf "subtitles=subtitles_file.mxf_Subtitle.srt:force_style='OutlineColour=&H80000000,BorderStyle=3,Outline=1,Shadow=0,MarginV=20" -acodec copy "output.mxf"
    
    
    0 讨论(0)
提交回复
热议问题