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

查看:811
本文介绍了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注意代表字幕,而不是 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天全站免登陆