title: How can I efficiently process a video on a per-request basis?
body: <p>I'm working on a web application in which a watermark must be applied to a video before it is sent to the user. Currently this watermark is static, and is created using ffmpeg when a video is updated. However, the application is changing so that a unique watermark will be added to the video for every request made for the video. This prevents a problem, as the video files may be fairly large and adding a watermark may be time-consuming (e.g., in some cases it may take over a minute to add a watermark), but the watermarks cannot be added on upload.</p>
  
  <p>I figured that streaming video could be a solution and implemented a solution using the nginx-rtmp-module, but several problems cropped up:</p>
  
  <ol>
  <li>RTMP solutions are a no-go as they appear to require Flash. This application must be supported on devices that don't support Flash at all, or don't (and won't) have it installed.</li>
  <li>I have considered using MPEG-DASH, but that enjoys only limited support. Namely, it is not supported on versions of Firefox targeted by the application, nor is it supported on iOS or some versions of Safari.</li>
  <li>I have considered HLS, but that enjoys even more limited support than MPEG-DASH.</li>
  <li>Regardless, I haven't actually been able to get Dash.js (the reference player for MPEG-DASH streams) to work, although that may be due to an encoding issue, I'm not sure.</li>
  </ol>
  
  <p>I wondered if there is a better (perhaps simpler) solution to this problem; perhaps streaming video isn't the way to go at all? <strong>Is there an efficient way to transcode a video file on-the-fly and start sending it to the browser quickly?</strong></p>
  
  <p>I am not against using solutions like node.js or other platforms/frameworks, and solutions can use HTML5 <code>&lt;video&gt;</code> if necessary.</p>