本文介绍了用字幕覆盖ffmpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被FFmpeg中的图像和字幕覆盖了,上面是命令

I am struck with overlaying image and subtitles in FFmpeg, above is the command

ffmpeg -i bg.png -vcodec libvpx-vp9 -i test.webm -i test.png -y -filter_complex "[1:v]scale=1210:682[scale1];[scale1]rotate=0:c=black@0:ow=rotw(0):oh=roth(0)[rotate0];[0:v][rotate0]overlay=x=291.12:y=206.9[overlay0];[overlay0]subtitles=test.ass,overlay=x=291.12:y=206.9[textoverlay10];[2:v]scale=630:354[scale2];[scale2]rotate=0:c=black@0:ow=rotw(0):oh=roth(0)[rotate2];[textoverlay10][rotate2]overlay=x=737.13:y=50.87[overlay2];[overlay2]subtitles=test.ass,overlay=x=291.12:y=206.9" -pix_fmt yuv420p -t 10 ver.mp4

我收到以下错误在过滤器Parsed_subtitles_3上找不到未标记输入板0的匹配流".这是覆盖图像和字幕的正确方法吗?请纠正我要去哪里的地方.

I am getting the following error "Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_subtitles_3".Is this the correct way of overlay images, and subtitles? please correct me where I am going wrong.

如果我在其顶部添加图像,请在下面的图片中找到

If I add an image on top of it, please find below image

推荐答案

命令中的简化示例

ffmpeg -loop 1 -i background.png -i bird.webm -filter_complex "[0]subtitles=subs.ass[bg];[bg][1]overlay=shortest=1,format=yuv420p" output.mp4

您可以复制和粘贴的示例

ffmpeg -f lavfi -i color=c=red:s=320x240,format=yuv444p -f lavfi -i color=c=green:s=280x200,format=yuv444p -f lavfi -i [email protected]:s=80x80,format=yuva444p -filter_complex "[0][1]overlay=(W-w)/2:(H-h)/2,subtitles=subs.ass:fontsdir=/tmp/font[bg];[bg][2]overlay=10:10:format=auto,format=yuv420p" -t 10 output.mp4

  • 滤色器用于合成输入(红色,绿色和蓝色框).
  • 重叠式过滤器以放置绿色和蓝色框.
  • 字幕过滤器以放置字幕.
  • 格式过滤器用于防止色度二次采样引起的模糊并启用alpha/透明的蓝色框.
  • 在本示例中,使用了
  • fontsdir 选项来定位外部字体.如果要使用系统中已安装的字体,可以省略 fontsdir .
    • Using color filter for synthetic inputs (the red, green, and blue boxes).
    • overlay filter to place the green and blue boxes.
    • subtitles filter to place subtitles.
    • format filter is used to prevent chroma-subsampling induced blurryness and to enable alpha/transparency for blue box.
    • fontsdir option was used in this example to locate external fonts. fontsdir can be omitted if you want to use fonts already installed in your system.
    • [Script Info]
      ; Script generated by Aegisub 3.2.2
      ; http://www.aegisub.org/
      Title: Default Aegisub file
      ScriptType: v4.00+
      WrapStyle: 0
      ScaledBorderAndShadow: yes
      YCbCr Matrix: None
      
      [Aegisub Project Garbage]
      Last Style Storage: Default
      
      [V4+ Styles]
      Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
      Style: Default,Bradley Hand,28,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,7,10,10,10,1
      
      [Events]
      Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
      Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,Line 1: Bradley Hand font\N{\fnComic Sans MS}Line 2: Comic Sans MS font{\fn}\NLine 3: Bradley Hand font
      

      • 使用 Alignment 选项定位字幕在ASS文件中.
      • 默认字体是通过ASS文件中的 Fontname 选项设置的.
      • 第2行的字体是使用 \ fn 覆盖设置的标签.
        • Subtitles were positioned with Alignment option in ASS file.
        • Default font was set with Fontname option in ASS file.
        • Font for Line 2 was set using \fn override tag.
        • 这篇关于用字幕覆盖ffmpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-13 04:38