Answers.Body: <p>You could do this by making subtitles from your data streams and then either playing them back on a media player that can display subtitles, or rendering them into the video.</p>
  
  <p>Most subtitle formats are very simple ascii files — to demonstrate, here's an srt subtitle file:</p>
  
  <pre><code>1
  00:00:01,046 --&gt; 00:00:02,540
  This is my home.
  
  2
  00:00:03,560 --&gt; 00:00:05,110
  I'm living here.
  
  3
  00:00:05,110 --&gt; 00:00:08,640
  My name's Nickel
  Mundabi Ngadwa Nickel.
  </code></pre>
  
  <p>It is pretty easy to generate them from any data source, as long as you have start [and finish] times. You can then insert them into a video file as a subtitle stream using ffmpeg:</p>
  
  <pre><code>ffmpeg -i inputvideo.mp4 -i inputsubtitles.srt -c:v copy -c:a copy -c:s mov_text outfile.mp4
  </code></pre>
  
  <p>Any player that is capable of displaying subtitles will be able to display them. SRT subtitles like these don't have formatting info though, so the format will depend on your player's settings.</p>
  
  <p>Other subtitle formats have more formatting capabilities. Here is an <a href="http://www.matroska.org/technical/specs/subtitles/ssa.html" rel="nofollow">Advanced Substation Alpha</a> subtitle file:</p>
  
  <pre><code>[Script Info]
  ScriptType: v4.00+
  PlayResX: 1920
  PlayResY: 1080
  
  [V4+ Styles]
  Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
  Style: Default,Univers,56,&amp;Hffffff,&amp;Hffffff,&amp;H0,&amp;H0,0,0,0,1,2,0,2,10,10,16,0,0
  
  [Events]
  Format: Layer, Start, End, Style, Text
  Dialogue: 0,0:00:01.05,0:00:02.54,Default,This is my home.
  Dialogue: 0,0:00:03.56,0:00:05.11,Default,I'm living here.
  Dialogue: 0,0:00:05.11,0:00:08.64,Default,My name's Nickel\NMundabi Ngadwa Nickel.
  </code></pre>
  
  <p>so basically you have the style definitions in the [V4+ Styles] section and the content in the [Events] section, with timing info for each bit of text. You can define multiple styles, and you can <a href="http://docs.aegisub.org/3.1/ASS_Tags/" rel="nofollow">add effects and inline formatting</a>.</p>
  
  <p>You can insert them into a video file (you'll need to use the Matroska video container because mp4 doesn't support <code>.ass</code> subtitles),</p>
  
  <pre><code>ffmpeg -i inputvideo.mp4 -i inputsubtitles.ass -c:v copy -c:a copy -c:s mov_text outfile.mkv
  </code></pre>
  
  <p>or you can "burn them in" by rendering them into the video stream thusly:</p>
  
  <pre><code>ffmpeg -i inputvideofile.mp4 -c:v libx264 -crf 20 -vf ass="inputsubtitlefile.ass" -c:a copy outputvideofile.mp4
  </code></pre>
  
  <p>So you can see it's not beyond the capabilities of a fairly simple shell script to do it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-04T13:33:57.117Z
Answers.Text: Awesome. I'd visualised them as subtitles and will certainly see if one of the options above meets the requirements. The one issue I'm anticipating is that there are small periods of time where multiple large comments were submitted. If, say, I display each comment until the next comment was posted they would be way too much text to read in too little time. I was hoping there might be some way to 'stack' comments vertically. It's probably something for me to play with to see how it looks before I look for other answers :)
Answers.UserDisplayName: Red Nightingale
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-04T23:35:53.883Z
Answers.Text: I belive there is an "overlap" option in the ASS definition, I'm pretty sure that it can stack overlapping comments, because I've had it do that to me when I didn't want it to.
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-04T05:03:50.380Z
Answers.LastActivityDate: 2015-02-04T09:58:23.660Z
Answers.LastEditDate: 2015-02-04T09:58:23.660Z
Answers.UserDisplayName: stib
Body: <p>I'm a software developer who has a video that has been pulled from a livestream event in which attendees commented on the video as it was running. I've got the data on when each comment was made and the text and am wondering if anyone is aware of software that I can 'push' text into the video in an automated manner with?</p>
  
  <p>More precisely I'd like to use some sort of command line tool to be able to pass some text (maybe font and font size as well), a frame/time to display the text, a frame/time to remove the text, and I'm guessing some sort of coordinate rectangle (being able to transition the text to a new location over time would be amazing but not necessary) and have it rendered into the video.</p>
  
  <p>Hope this makes sense, happy to clarify anything further.</p>
  
Tags: <software-recommendation><post-production><automation>
Title: Post production automated addition of text
UserDisplayName: Red Nightingale
ThreadText: # Post production automated addition of text
  
  (Asked by: username_0 on 2015-02-04)
  
  I'm a software developer who has a video that has been pulled from a livestream event in which attendees commented on the video as it was running. I've got the data on when each comment was made and the text and am wondering if anyone is aware of software that I can 'push' text into the video in an automated manner with?
  
  More precisely I'd like to use some sort of command line tool to be able to pass some text (maybe font and font size as well), a frame/time to display the text, a frame/time to remove the text, and I'm guessing some sort of coordinate rectangle (being able to transition the text to a new location over time would be amazing but not necessary) and have it rendered into the video.
  
  Hope this makes sense, happy to clarify anything further.
  
  **Tags:** software-recommendation, post-production, automation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-02-04. Score: 4 | Accepted answer
  
  You could do this by making subtitles from your data streams and then either playing them back on a media player that can display subtitles, or rendering them into the video.
  
  Most subtitle formats are very simple ascii files — to demonstrate, here's an srt subtitle file:
  
  ```
  1
  00:00:01,046 --> 00:00:02,540
  This is my home.
  
  2
  00:00:03,560 --> 00:00:05,110
  I'm living here.
  
  3
  00:00:05,110 --> 00:00:08,640
  My name's Nickel
  Mundabi Ngadwa Nickel.
  
  ```
  
  It is pretty easy to generate them from any data source, as long as you have start [and finish] times. You can then insert them into a video file as a subtitle stream using ffmpeg:
  
  ```
  ffmpeg -i inputvideo.mp4 -i inputsubtitles.srt -c:v copy -c:a copy -c:s mov_text outfile.mp4
  
  ```
  
  Any player that is capable of displaying subtitles will be able to display them. SRT subtitles like these don't have formatting info though, so the format will depend on your player's settings.
  
  Other subtitle formats have more formatting capabilities. Here is an [Advanced Substation Alpha](http://www.matroska.org/technical/specs/subtitles/ssa.html) subtitle file:
  
  ```
  [Script Info]
  ScriptType: v4.00+
  PlayResX: 1920
  PlayResY: 1080
  
  [V4+ Styles]
  Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
  Style: Default,Univers,56,&Hffffff,&Hffffff,&H0,&H0,0,0,0,1,2,0,2,10,10,16,0,0
  
  [Events]
  Format: Layer, Start, End, Style, Text
  Dialogue: 0,0:00:01.05,0:00:02.54,Default,This is my home.
  Dialogue: 0,0:00:03.56,0:00:05.11,Default,I'm living here.
  Dialogue: 0,0:00:05.11,0:00:08.64,Default,My name's Nickel\NMundabi Ngadwa Nickel.
  
  ```
  
  so basically you have the style definitions in the [V4+ Styles] section and the content in the [Events] section, with timing info for each bit of text. You can define multiple styles, and you can [add effects and inline formatting](http://docs.aegisub.org/3.1/ASS_Tags/).
  
  You can insert them into a video file (you'll need to use the Matroska video container because mp4 doesn't support `.ass` subtitles),
  
  ```
  ffmpeg -i inputvideo.mp4 -i inputsubtitles.ass -c:v copy -c:a copy -c:s mov_text outfile.mkv
  
  ```
  
  or you can "burn them in" by rendering them into the video stream thusly:
  
  ```
  ffmpeg -i inputvideofile.mp4 -c:v libx264 -crf 20 -vf ass="inputsubtitlefile.ass" -c:a copy outputvideofile.mp4
  
  ```
  
  So you can see it's not beyond the capabilities of a fairly simple shell script to do it.
  
  > **Comments:**
  > **username_0**: Awesome. I'd visualised them as subtitles and will certainly see if one of the options above meets the requirements. The one issue I'm anticipating is that there are small periods of time where multiple large comments were submitted. If, say, I display each comment until the next comment was posted they would be way too much text to read in too little time. I was hoping there might be some way to 'stack' comments vertically. It's probably something for me to play with to see how it looks before I look for other answers :)  
  > **username_1**: I belive there is an "overlap" option in the ASS definition, I'm pretty sure that it can stack overlapping comments, because I've had it do that to me when I didn't want it to.  
  
  ---
  
  