I'm feeding ffmpeg from stdin and do several transcoding operations in one command only. The issue is that ffmpeg seems to transcode them(or at least write on disk) sequently (i.e. first it transcodes/writes audio/video and then it transcodes the subtitles). This way it takes minutes before you get any subtitle content which translates in a poor user experience(if the transcoding is "on demand"/live) because the client needs to wait for the subtitles even if the audio/video is ready(at least partially). How can I change that? How can I make ffmpeg write the subtitles to the disk as soon as they are copied/transcoded?
Note: I believe the transcoding is done concurrently for the subtitles too but for some reasons it flushes/writes them on disk only after the audio/video transcoding completes. That's because there is no way ffmpeg could start reading the input from beginning after a/v transcoding is done because it can't seek/start over from stdin.
Below is a sample of my command:
ffmpeg -nostdin -i - -map 0:2 -c:0 webvtt -f webvtt first.vtt \
-map 0:3 -c:0 webvtt -f webvtt second.vtt \
-map 0:0 -c:0 copy -map 0:1 -c:1 aac \
-use_timeline 1 -min_seg_duration 1000000 \
-use_template 1 -init_seg_name $RepresentationID$-0.mp4s \
-media_seg_name $RepresentationID$-$Number$.mp4s \
-adaptation_sets "id=mkv/0,streams=0 id=mkv/1,streams=1" \
-f dash -dash 1 out.mpd