1

I have a content creation site I am building and im confused on audio and video.

If I have a content creators audio or video stored in s3 and then I want to display their file will the html video player or audio player stream the media or will it download it fully then play it?

I ask because what if the video or audio is significantly long. like 2 hours for example. I need to know how to solve the use case.

Lastly what file type is most acceptable for viewing on webpages? It seems like MPEG-4 is the best bet. Is that true?

2 Answers2

2

Most video player clients and browsers will attempt to stream the video if they can.

For an mp4 video file hosted on a server, so long as the header is at the start and the server accepts range requests, this will mean the player downloads the video in chunks and starts playing as soon as it has enough to decide the first frames.

For more professional streaming services, they will generally use an adaptive bit rate streaming protocol like DASH or HLS (see this answer: https://stackoverflow.com/a/42365034/334402) and again the video will be streamed in chunks, or segments, and will start playing while it is streaming.

To answer your last question you need to be aware that the raw video is encoded (e.g. h.264, VP9 etc) and the video, audio, subtitle etc tracks stored in a video container (e.g. mp4, Web etc).

The most common format is probaly h.264 encoded and mp4 containers at this time.

The particular profile for h.264 can matter also depending on the device - baseline is probably the most supported profile at this time. You can find examples of media support for different devices online, e.g. for Android: https://developer.android.com/guide/topics/media/media-formats

Mick
  • 24,231
  • 1
  • 54
  • 120
2

@Mick's answer is spot on. I'll just add that mp4 (with h264 encoding) will work in just about every browser out there.

The issue with mp4 files (especially with a 2 hour long movie) isn't so much the seeking & streaming. If your creator creates a 4K video - thats what you'll deliver to everyone (even mobile phones). HLS streaming on the other hand has adaptive bitrates - where the video adapts to both the screen & the available network speeds. You'll get better playback results with less buffering (and if you're using AWS - a LOT LESS data egress) with video streaming.

(there are a bunch of APIs and services that can help you do this - including api.video (where I work), Mux and others).

Doug Sillars
  • 1,625
  • 5
  • 7