Let say I have an MKV with a video stream, an audio stream and a subtitles stream.
I would like to burn this subtitle into my video directly from the subtitle stream.
so far, this is my command line :
ffmpeg.exe -i "MyMovie.mkv" -map 0:0 -map 0:1 -vf subtitles=sub.srt out.mkv
So far so good. But, my subtitles are inside the movie and I need to extract them before. I used this :
ffmpeg.exe -i "MyMovie.mkv" -f srt sub.srt
But this operation is too long : ~25 sec on my PC for a 2.5Go MKV. I need something faster because I need to start streaming the output to an app as soon as possible. (I did not mentioned the others command line arguments I used to achieve this streaming properly because my question is not about that.)
I know it is not possible to get the stream directly like this :
ffmpeg.exe -i "MyMovie.mkv" -map 0:0 -map 0:1 -vf subtitles=[0:s:0] out.mkv
But this is something I would love.
edit :
But I already know this kind of command line do not exist. (But if I'm wrong, please, let me know.)
Now, I would like to write this kind of filter myself, and compile ffmpeg with it. But I have no idea where to start.
Can anyone help me to start ?
Thank you
your are looking for the "picture based" mode
ffmpeg -i input.mkv -filter_complex "[0:v][0:s]overlay[v]" -map [v] -map 0:a <output options> output.mkv
here we map the 1st(0:s) subtitle stream on the 1st video(0:v)
described with more details here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.