video - FFmpeg subtitle filter set start time
问题描述
I am trying to burn-in subtitles for a shorter section of a video, but using the subtitles filter always starts from the beginning of the subtitle stream, not at the specified start time, even when copying from the same video.
So for example if I start an encode 10 minutes in to a film, the video will properly be set from there, but the subtitles will start from the beginning (10 minute offset in this case).
ffmpeg -y -ss 600.0 -to 660.0 -i movie.mkv -filter_complex "[0:0]subtitles='movie.mkv':si=1[v]" -map "[v]" -c:v libx265 -crf 22 output.mkv
This is not a problem when using picture based subtitles and the overlay filter, such as:
-filter_complex "[0:0][0:2]overlay[v]"
It seems to only affect text based subtitles. I don't know if this is just not possible and will require another solution, or if I am approaching it wrong. Any help is appreciated!
解决方案
The issue was that I was using "fast seek" time, aka setting it before the input, which does not seem to be compatible with the subtitle
filter. Which means the -ss
and -to
need to be moved after the input -i movie.mkv
ffmpeg -y -i movie.mkv -ss 600.0 -to 660.0 -filter_complex "[0:0]subtitles='movie.mkv':si=1[v]" -map "[v]" -c:v libx265 -crf 22 output.mkv
推荐阅读
- php - 结合 2 个 SQL 语句 PHP OOP
- javascript - 删除函数后如何知道数组/对象是否为空?
- firebase - 无法安装 nodered-contrib-firebase-storage
- javascript - 如何在 React 中更改状态对象内的键状态?
- .net - 是否可以通过 .net core 3.0 在 Linux 中使用 p4bridge.dll?
- python - 'int' 对象不可调用堆排序函数
- ios - Flutter ios 构建失败 - Distill 因未知原因而失败
- jenkins - Jenkinsfile 不能在 Windows (bat) 中 CD
- javascript - 如何正确等待 javascript 中异步函数的返回?
- java - 为什么 Gradle 找不到现有的工件?