So from my web server, I would like to use FFMPEG to transcode a media file for use with an HTML <audio>
or <video>
tag. Easy enough right?
The conversion would need to take place in real-time, when an HTTP client requested the converted file. Ideally the file would be streamed back to the HTTP client as it is being transcoded (and not afterwards at the end, since that would potentially take a while before any data starts being sent back).
This would be fine, except that in today's browsers, an HTML5 audio or video tag requests the media file in multiple HTTP requests with the Range
header. See this question for details.
In that question linked above, you can see that Safari requests weird chunks of the file, including the ending few bytes. This poses a problem in that the web server WOULD have to wait for the conversion to finish, in order to deliver the final bytes of the file to conform to the Range
request.
So my question is, is my train of thought right? Is there a better way to deliver transcoding content to an <audio>
or <video>
tag that wouldn't involve waiting for the entire conversion to finish? Thanks in advance!