ffmpeg 将字幕轨道设置为默认值 [英] ffmpeg set subtitles track as default

查看:87
本文介绍了ffmpeg 将字幕轨道设置为默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过将 .ass 字幕轨道添加到带有 ffmpeg 的 mkv 视频,它不会被设置为默认轨道,因此在播放时您必须手动打开字幕.是否可以为字幕轨道设置默认标志?

By adding an .ass subtitles track to an mkv video with ffmpeg, it isn't set as default track, so on playback you have to manually turn on subtitles. Is it possible to set the default flag for the subtitles track?

使用的ffmpeg命令:

ffmpeg command used:

ffmpeg -i video.mp4 -i subtitles.ass -c:v libx264 -preset veryslow 
 -pix_fmt yuv420p10le -c:a copy -c:s copy output.mkv

请注意,我想保留 .ass 字幕格式,将字幕转换为 mov_text 就像在这个类似问题中建议的那样:如何使用 ffmpeg 设置默认流

Note that I want to keep .ass subtitle format, not convert the subtitles to mov_text like suggested in this similar question: How to set default streams with ffmpeg

之后可以像这样使用 mkvpropedit 设置默认标志:

There is the possibility to set the default flag afterwards with mkvpropedit like this:

mkvpropedit output.mkv --edit track:s1 --set flag-default=1

但是可以直接用 ffmpeg 来做到这一点吗?

But is it possible to do this directly with ffmpeg?

推荐答案

我认为按照 这个补丁 现在可以了.至少对我来说它适用于:

I think as per this patch this is now possible. At least for me it works with:

ffmpeg -i in.mp4 -i in.srt -c copy -disposition:s:0 default out.mkv

注意 -disposition:s:0 中的 s 在这种情况下代表 subtitle 而不是 stream.要按索引选择第二个蒸汽,请使用 -disposition:1.

Note s in -disposition:s:0 in this case stands for subtitle and not stream. To select the second steam by index use -disposition:1.

这篇关于ffmpeg 将字幕轨道设置为默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆