Live data from Hacker News

Show HN: I took back Video.js after 16 years and we rewrote it to be 88% smaller

videojs.org

81–90 of 170 posts

Re: Show HN: I took back Video.js after 16 years and we rewrote it to be 88% smaller

#81
post #46

I've never used video.js, and the site/advertising seems to be fairly oriented towards people who have used it or are familiar with it. I had one question I couldn't answer reading the site: what makes this different from the native html video element? AFAICT just the transport controls?

Most browsers don't support HLS or DASH.

(And why does that matter? Dynamic bitrate adjustment. The chunks are slightly easier to cache as well.)

Re: Show HN: I took back Video.js after 16 years and we rewrote it to be 88% smaller

#82
post #70

In case anyone's wondering, this website's syntax highlighting color scheme is called "gruvbox", which I quite like but took an embarrassingly long time to track down https://github.com/morhetz/gruvbox

Any idea what the website's built with? I really like the design/UI tbh

[deleted]

Re: Show HN: I took back Video.js after 16 years and we rewrote it to be 88% smaller

#83
post #15

Earlier quoted context omitted.

I'm on the Video.js team, just wanted to say thank you! Means a lot and we'd be eager to hear your experience trying it out. Feel free to drop a GitHub issue or discussion post if you ever get a chance :)

From me, this is a massive relief after we just deployed a bunch of videos to Vimeo. The next week they were bought. I'm a one-man operation. In the order of hundreds of videos served a week. All I want is control over my own destiny. If this and a VPS can do that, that'll be amazing . Thank you for doing this.

You absolutely can do that with videojs, it's very easy.

Might need to consider bandwidth and the usual mitigation against scrapers if you're serving video unauthenticated.

Re: Show HN: I took back Video.js after 16 years and we rewrote it to be 88% smaller

#84

I'm not familiar with video hosting but have played with html5 video player but I have this question: on the servers side, do I have to host a specific endpoint that serves chunks of video? Lets say I take 720p video @ 800mb and I chunk it into 2mb pieces with ffmpeg. So I have a folder somewhere (webserver, cdn, blob storage) with the original 4K video, then generate downscaled versions for 1440p, 1080p, 720p, so I…

If you don't need to switch versions at runtime (ABR), you don't even need to chunk it manully. Your server has to support range requests and then the browser does the reasonable thing automatically.

The simplest option is to use some basic object storage service and it'll usually work well out of the box (I use DO Spaces with built-in CDN, that's basically it).

Re: Show HN: I took back Video.js after 16 years and we rewrote it to be 88% smaller

#86

I'm not familiar with video hosting but have played with html5 video player but I have this question: on the servers side, do I have to host a specific endpoint that serves chunks of video? Lets say I take 720p video @ 800mb and I chunk it into 2mb pieces with ffmpeg. So I have a folder somewhere (webserver, cdn, blob storage) with the original 4K video, then generate downscaled versions for 1440p, 1080p, 720p, so I…

If you don't need to switch versions at runtime (ABR), you don't even need to chunk it manully. Your server has to support range requests and then the browser does the reasonable thing automatically. The simplest option is to use some basic object storage service and it'll usually work well out of the box (I use DO Spaces with built-in CDN, that's basically it).

Yes, serving an MP4 file directly into a tag is the simplest possible thing you can do that works. With one important caveat: you need to move the "MOOV" metadata to the front of the file. There are various utilities for doing that.

Re: Show HN: I took back Video.js after 16 years and we rewrote it to be 88% smaller

#89

I'm not familiar with video hosting but have played with html5 video player but I have this question: on the servers side, do I have to host a specific endpoint that serves chunks of video? Lets say I take 720p video @ 800mb and I chunk it into 2mb pieces with ffmpeg. So I have a folder somewhere (webserver, cdn, blob storage) with the original 4K video, then generate downscaled versions for 1440p, 1080p, 720p, so I…

It's not quite as simple as that because the chunks should be self-contained; they need to start with an IDR keyframe, which fully resets the decoder. That allows the player to seek to the start of any chunk.

That means when you're encoding the downscaled variants, the encoder wants to know the size of the file segments so it can insert those IDR frames. Therefore it's common to do the encoding and segmentation in a single step (e.g. with ffmpeg's "dash" formatter).

You can have variable-duration or fixed-duration segments. Supposedly some decoders are happier with fixed-duration segments, but it can be fiddly to get the ffmpeg settings just right, especially if you want the audio and video to have exactly the same segment size (here's a useful little calculator for that: https://anton.lindstrom.io/gop-size-calculator/)

For hosting, a typical setup would be to start with a single high-quality video file, have an encoder/segmenter pipeline that generates a bunch of video and audio chunks and DASH (.mpd) and/or HLS (.m3u8) manifests, and put all the chunks and manifests on S3 or similar. As long as all the internal links are relative they can be placed anywhere. The video player will start with the top-level manifest URL and locate everything else it needs from there.

Re: Show HN: I took back Video.js after 16 years and we rewrote it to be 88% smaller

#90
post #86

Earlier quoted context omitted.

If you don't need to switch versions at runtime (ABR), you don't even need to chunk it manully. Your server has to support range requests and then the browser does the reasonable thing automatically. The simplest option is to use some basic object storage service and it'll usually work well out of the box (I use DO Spaces with built-in CDN, that's basically it).

Yes, serving an MP4 file directly into a tag is the simplest possible thing you can do that works. With one important caveat: you need to move the "MOOV" metadata to the front of the file. There are various utilities for doing that.

Yea, passing `-movflags +faststart` to ffmpeg when processing the file should be enough.
Post reply on HN