I'm trying to create an HLS subtitle playlist from subtitles embedded within a video file. So the input looks something like this:
container: mkv stream 0: video h264 stream 1: audio aac stream 2: subtitle ass
And the output folder should look something like this:
index.m3u8 subs_0.vtt subs_1.vtt subs_2.vtt ...
Currently, I get to the desired output by using the following two commands:
ffmpeg \ -i in.mkv \ -map 0:2 \ -scodec webvtt \ temp.vtt ffmpeg -y \ -i temp.vtt \ -scodec webvtt \ -f segment \ -segment_list_type m3u8 \ -segment_list_size 0 \ -segment_time 6 \ -segment_start_number 0 \ -segment_format webvtt \ -segment_list index.m3u8 \ -map 0:0 \ -scodec copy subs_%d.vtt
However, due to constraints in the surrounding system, I'd prefer to combine these two steps into a single command. But, whenever I try that, the output file is collapsed to a single subs_0.vtt file.
Currently failing attempt:
ffmpeg -y \ -f matroska,webm \ -i in.mkv \ -scodec webvtt \ -f segment \ -segment_list_type m3u8 \ -segment_list_size 0 \ -segment_time 6 \ -segment_start_number 0 \ -segment_format webvtt \ -segment_list index.m3u8 \ -map 0:2 \ out_%d.vtt
This command only creates a single vtt file, rather than the desired segmented files.
Is there a way to combine the two commands without losing the segmentation?
I'm not sure if this is relevant, so I'm going to add it here. The failing command produces multiple "Non-monotonous DTS in output stream" messages. It sources from "segment", so I'd assume at least the correct format should be active, but maybe it prevents the segmented from splitting the file?
[segment @ 0000011cec905440] Non-monotonous DTS in output stream 0:0; previous: 90402, current: 90400; changing to 90403. This may result in incorrect timestamps in the output file.