Body: <p>I have a stream (rtmp) and I would like to generate some subtitles for it(based on what's happened on stream). I can generate it like a pipe, or some other way. I use script like this:</p>
  
  <pre><code>for i in $(seq -f "%02g" 0 20); do echo "
  00:00:$i,000 --&gt; 00:00:$i,999
  caption $i
  "; sleep 1; done | ffmpeg -nostdin \
  -i "rtmp://domain.com/streamName live=1" \
  -f srt -re -i - \
  -c copy \
  -c:s text \
  -flush_packets 1 -f flv rtmp://output
  </code></pre>
  
  <p>the first part of a script is create a pipe with actually subs, pipe it to ffmpeg, and ffmpeg should merge subs with the stream.
  The point is that ffmpeg starts generating output only after the pipe is closed, and subtitles generation is ended.
  Is it possible to force ffmpeg start generation of output as soon as first lines in pipe appears?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-29T14:41:48.800Z
Comments.Text: Works here when I pipe an existing SRT file.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-29T16:31:49.850Z
Comments.Text: @Gyan because existing SRT could be read to the end, while I actually need to generate it on the fly
Comments.UserDisplayName: Vitaliy Lozoviy
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-29T17:17:24.667Z
Comments.Text: With `-re` flag, ffmpeg reads the input in real time - it delays reading the next packet until time elapsed is equal to media timestamp
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-30T05:55:42.187Z
Comments.Text: @Gyan without `-re` it still wait until srt `EOF` before output starts. The difference is that with `-re` output is thrown like a realtime stream, while without it - all at once,
Comments.UserDisplayName: Vitaliy Lozoviy
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-10T18:43:12.863Z
Comments.Text: Did you ever figure this out? Need to do this as well
Comments.UserDisplayName: Beefy_Swain
Tags: <ffmpeg><subtitles>
Title: Make ffmpeg read subtitles as stream
UserDisplayName: Vitaliy Lozoviy
ThreadText: # Make ffmpeg read subtitles as stream
  
  (Asked by: username_0 on 2019-08-29)
  
  I have a stream (rtmp) and I would like to generate some subtitles for it(based on what's happened on stream). I can generate it like a pipe, or some other way. I use script like this:
  
  ```
  for i in $(seq -f "%02g" 0 20); do echo "
  00:00:$i,000 --> 00:00:$i,999
  caption $i
  "; sleep 1; done | ffmpeg -nostdin \
  -i "rtmp://domain.com/streamName live=1" \
  -f srt -re -i - \
  -c copy \
  -c:s text \
  -flush_packets 1 -f flv rtmp://output
  
  ```
  
  the first part of a script is create a pipe with actually subs, pipe it to ffmpeg, and ffmpeg should merge subs with the stream.
  The point is that ffmpeg starts generating output only after the pipe is closed, and subtitles generation is ended.
  Is it possible to force ffmpeg start generation of output as soon as first lines in pipe appears?
  
  **Tags:** ffmpeg, subtitles
  
  > **Comments:**
  > **username_1**: Works here when I pipe an existing SRT file.  
  > **username_0**: @username_1 because existing SRT could be read to the end, while I actually need to generate it on the fly  
  > **username_1**: With `-re` flag, ffmpeg reads the input in real time - it delays reading the next packet until time elapsed is equal to media timestamp  
  > **username_0**: @username_1 without `-re` it still wait until srt `EOF` before output starts. The difference is that with `-re` output is thrown like a realtime stream, while without it - all at once,  
  > **username_2**: Did you ever figure this out? Need to do this as well  
  
  ---
  
  ## 0 answers
  
  