over 1 year ago Syntax Podcast
Streaming Video in 2025
- 02:18 HLS video streaming explained
- 03:25 M3U8 files explained
- 04:12 Transcoding video with FFmpeg
- 07:34 Orchestrating FFmpeg with JavaScript
- 08:07 Video encoding queues
- 09:04 YouTube video encoding
- 15:27 Hosting video chunks
- 18:57 CDNs for video delivery
- 26:38 Video player libraries
- 27:41 MediaChrome video player
- 30:15 Cloudflare Stream
- 38:17 Cloudinary for video
- 40:45 Bitmovin video platform
- 42:13 Live video streaming
Live video streaming
Wes Bos
use a service to sort of generate them for you or they generally, the way they work is they run them through AI, and then they have people that that go through them.
Scott Tolinski
tell it what to do, natural language, and it writes the code for you and submits a PR. And I put it to the test through 5 different PRs, and, you'll have to see how that test went. Awesome. Alright. Thanks, everyone, for tuning in. We'll catch you later.
Scott Tolinski
a, sheer strength. Sheer strength. Yes. Either way, it's got 10 milli 10,000 milliamps batteries. It's very Node.
Wes Bos
Shake it more.
Scott Tolinski
That said, I have been using source record as the primary means of recording nowadays Cloudflare, we use different adaptive streaming levels from 3 60 p to 10 80 p. Yes.
Scott Tolinski
in learning a little bit more explicitly about that process.
Wes Bos
the different caption tracks. So you could do them in different languages and whatnot. And I think I wanna move my stuff over to that because then it's all altogether. Right?
Scott Tolinski
Smash that subscribe button. We're doing so much on YouTube these days. It's more than just a video podcast. It's more than just us sitting here,
Scott Tolinski
stick it on the back of your phone, and it MagSafe charges your phone all day of the week anytime you want. And I've actually found this to be nice even being around the house sometimes. Like, I'm in the gym, and I don't want to bring a thing. And my phone's about to die, and I'm listening to music on my phone. So I'll just grab the power bank and snap it on there, and then I don't have to go look for a charger or whatever. So, yeah, I found this to be a nice little Sanity, battery. Make sure I didn't break it. Sometimes I even bring the power bank to my desk just because I don't wanna
Wes Bos
Scott and I's voices.
Wes Bos
and it's just like a bad UI. It works it works great, but it's just not the UI you want for being able to select multiple inputs at once. It's sir it's certainly not, like, super Aaron Francis and and Steve,
Scott Tolinski
which is
Scott Tolinski
Like, I feel like I have to do a test record every single time before I actually record.
Scott Tolinski
So or, like, we're playing cards outside. Right? We're playing cards outside. We're playing some Euchre, some Midwest Euchre. We put that on there. We turn the little lamp on. People can plug their phones into it, whatever.
Wes Bos
traditionally, Alright. That's good. Alright. So back to to video.
Scott Tolinski
movie via, like, streaming it into FFmpeg,
Scott Tolinski
down. People skip 30 seconds, and it goes right back up. Yep. And and, you know, YouTube obviously has, like, Wes in class for these types of analytics. You can see so much with that stuff.
Wes Bos
Wes. I think that's it. Yeah. Let us know if you have any other tips on video streaming. I would love to hear what you have run into and how you've done it.
Scott Tolinski
does Deno 2 deliver, yeah, you in this case, you need a bucket for the source. You need a bucket for the destination. You need Mhmm. A process to convert them. You need a CDN, and then you need a database to actually store where they're at. Unless if yeah. It's, of course, if you're doing a whole upload,
Scott Tolinski
consumed. Now, obviously, that's not gonna be like YouTube Wes you get all of the information on,
Scott Tolinski
Pop on there.
Wes Bos
sources at once. And a source can be a microphone, can be a
Scott Tolinski
and it would be, like, 10 gigabytes for 10 seconds of video. And I was like, I'm doing something wrong here. There's there's a there's a problem.
Wes Bos
the ability to capture multiple turn on
Scott Tolinski
jabbering into mics. We're we got really deep in-depth videos from CJ, who's been just really crushing it. He he made a video on Deno 2 that came out today at the time of recording this, which JS,
Scott Tolinski
what I was working warp, so I'm I'm stoked to see this, especially the interface is nice. It's, like, $5 or something like that. Like, I I think the guys should charge more. It's not like a a monthly thing or anything. Yeah. So pretty sure. I'm going to sick pick the Anker MagGo, Yeah. Yeah. I think I'm gonna gonna hold out too. That's I've decided to wait till the m five. I I've made that because I did see that they might be making the little notch camera thing
Wes Bos
to I was writing massive file sizes. All the way down. I was trying to take raw video,
Scott Tolinski
Shameless plugs. What do you got for us, Scott? Shameless plugs. Head on over to youtube forward slash at syntax f m.
Wes Bos
But that's also part of the HLS
Scott Tolinski
how how your video JS being the the slowest I've ever seen my computer run. And this computer, like, does not struggle. I tried to do some magic masking of just a little bit, and my computer was just like, hold up here. I I think I'm about to crash. And it's too it was just, like, way too much for it. And I've never really had that experience on this computer. And Yeah. It's a bummer because the magic masking stuff is so cool. I wish I could, actually use it in a regular capacity.
Scott Tolinski
Wow. Okay. Yeah. Don't go vertical with it. I was I I just lost it going vertical. That's, yeah, sheer It's just a big battery, You should look up exactly, like, a good structure to do that before you just choose to use it. Database for these types of things because
Scott Tolinski
But, yeah, battery, hedge trimmer, way to go. Yes. Yeah. Weed leader, all that stuff.
Wes Bos
I've always done my subtitles as a track But let's rattle through a couple other options.
Wes Bos
especially the windows. You wanna record a window, and if you tap over top of that window, and that will provide captions for you. You have to get the captions made somewhere. Right? You you either have them done by AI or you can, another product is still in a bucket in 1 place in the world, and it is not CDNized.
Scott Tolinski
so I I wasn't used to ever having, that would that seems like that would be awful to have an extension cord for that.
Wes Bos
I got a hedge trimmer that's battery. And I was like, I hate running an extension cord. It's such a pain in the butt. I only ever had gas of those before, then you lose
Scott Tolinski
hit those. I also just did a video on where I put Copilot workspace to the test with 5 GitHub issues. And the whole thing is that you convert
Scott Tolinski
But if you wanna do this on your own, another and this sounds like a Mux ad for how much I'm pushing them. But another Mux feature is Mux data that has really super good video analytic data, Yes. I would love to know. Well, it's different for, like, every video, really. Maybe not every video. There's definitely a rhyme and a reason to it. But if you use YouTube DL,
Scott Tolinski
So there's a lot of, like,
Wes Bos
We did we clip on a, like, a 10 second clip on the end that says is
Wes Bos
who is which speaker.
Wes Bos
And then, there's gotta be somewhere for them to say, hey. You can't do this.
Wes Bos
it's been pretty good. There's a couple bugs I found here here and there, but I've I've logged them in the in the GitHub, and the the author has been really responsive in fixing them. So it's just something I've wanted for a long time. OBS has one called source record, And where do you put big files? Well, you can put them on They're all so painful. So the the one that YTDLP
Scott Tolinski
it's like a pretty Yeah. Decently Let's see how well this works. Same thickness as my phone. Yeah.
Scott Tolinski
a GitHub issue with natural language into a PR.
Wes Bos
for the longest time, when I'm recording, I have wanted like a lot of these other platforms as the services Yarn, so I would feel a month to store, spec, which is
Scott Tolinski
geographic data and stuff like that, but it's still Mhmm. Pretty decent.
Wes Bos
Yeah. What's that for? nice experience.
Wes Bos
Yeah. Word. Clip stitching is another one if you wanna stitch clips together. This is actually something we do on the Syntax website for audio, You could pay people to figure that out, but Totally.
Wes Bos
Yeah. Wes, no. Switch profiles and then push the new profiles recording. Yeah. Is different. Yeah. Totally. Definitely orange cloud in front of it, it's still not going to, upload it, like, for example, Blue Sky,
Wes Bos
and I wanna be able to just record them all at once,
Scott Tolinski
Works super Wes. And you just
Wes Bos
and see exactly visually where the ad reads are because the it goes
Scott Tolinski
you know, individual users and in fact, folks on video will get to see. I have a
Wes Bos
and I'm good to go. So that's what I've been doing. But, yeah, the, But then you gotta have multiple profiles because, like, what happens if you don't wanna record them? and like, oh, maybe soon, but I don't I don't know what the the plan is there. They do have WebRTC or 16 year $16 a year to hold it. So, and that will output JS the I keep hearing about Bunny. Bunny
Scott Tolinski
will use this PolyCapture. It's the app I wanted to build and,
Cloudflare Stream
Wes Bos
there you go. Yeah. Just trying to win here. Yeah. Access control. Basically, when you want to provide a link to something that is in a bucket, whether it's s 3 or r 2 or any of these things, they all they all follow the same Welcome to Syntax. Today, I got an episode for you on streaming video in 2025,
Wes Bos
be CDNized. You have to set up either rules in a worker, or you have to set up some rules based on bucket names then that goes in front of CloudFront as a CSS, and then, like, whoo. And then you have you have costs for all of those things
Wes Bos
dash a m zed. Like, it it uses Amazon in the URL because Amazon made the spec. So you either have to do that, or in the video player. So there's a track element in HTML that you can use to point towards a
Scott Tolinski
I probably wouldn't recommend it unless you are interested in building out click to start, pnpm engineer per year to $300
Wes Bos
Even if you have Cloudflare Yeah. Well, it's it's kinda funny because when I posted about this being able to use Cloudflare r two, to parse it. And I I believe that's HLS JS is the the big one. That's the big one. That's the one everybody uses. HLS is actually, built into Safari, web component tags. And it's smart enough to, like, look up for the parent media source and and communicate with it. And it's such a great experience. Yes. It is. And it honestly, MediaChrome
Wes Bos
it's there's a much bigger company. So, like, at at a certain point, they say, decipherable words that we use to detect the people that are are visiting. And resolution and bit rate is kind of a funky thing because and so on for however many versions you wanna be able to offer So for whatever your for my database. Yeah.
Wes Bos
they'll give you $1,000 Deno,
Wes Bos
and then lock down access to the m three u eight. It really depends on if you think people are going to be,
Scott Tolinski
There's also AWS, like we mentioned many times. There's the whole VOD workflow, the video on demand workflow that you can it's essentially like a one click to start up this this workflow. But, again,
Scott Tolinski
to maintain. I wouldn't use this one unless you are serious serious.
Wes Bos
it's still not a thing. Like, I could understand 4 years ago when their initial product, but on request.
Scott Tolinski
But now
Wes Bos
like Wes talked about using FFmpeg to transcode your video.
Wes Bos
Cloudflare r two by itself
Wes Bos
space
Wes Bos
started as, like, a CDN company. Now they have one called Bunny Stream,
Wes Bos
So It still doesn't do 4 k, though. So it's Node do 4 k. Not worth your your time. Doesn't do 4 k, really. And I I think part of that is because they, again, they bill based on,
Wes Bos
knocking at my door saying, you're not following terms of service. Mhmm. And now it Scott me, like, $10 Oh, that's nice. It's nice. Yeah. Yeah. Yeah. Not having to run an extension cord
Scott Tolinski
people streaming hockey games,
Wes Bos
support. Okay. I do wanna say really quickly about the Cloudflare r two.
Wes Bos
on Bunny. It's kinda I think it's their kinda their jab at Cloudflare Workers.
Wes Bos
Mhmm. So that's that's an option as well. But I need to Yeah. I'm probably gonna move it to Mux fairly soon. And I was talking to Dave Kiss, download them and stream them in as as they are needed.
Scott Tolinski
Yeah. $10 to stream your video. You could be streaming on Mux for, You can have user generated.
Scott Tolinski
stream that they've gotten and putting it on an iframe, because that's what people were doing. Like, they you know, the sites have, like, these big old like, filled with 10,000 ads on them, and that's how they make their their money e Oh, yeah. Illegally thing. So that what they do is they people were copying the m three u eights, putting them on a single page with an iframe and sharing that so there'd be no ads. And then, of course, they've gotten smarter than that. Yes. Oh, man. They gotta lock it down. That's crazy.
Wes Bos
stealing your video or not. In a lot of cases, even in, like, big TV stations, it's not worth the the hassle and the extra compute to to check for access 2 to 4, sometimes longer somewhere.
Wes Bos
caching around the world for those your video hunks. For your hunks. Yeah. For your hunks. I did just find the FAQ.
Wes Bos
to to stream all my video.
Scott Tolinski
And and then puts it into another bucket.
Wes Bos
pretty comfortable going there.
Wes Bos
towards your credit, which is a lot. You can you could probably host all of Vercel up tutorials on that many times over. Right? Man. That's cool. In exchange for a logo on the page.
Wes Bos
lock those things down, or or people simply are just like And and then they will then point towards a actual file that lives somewhere, which is a dot t s file. So you simply are just just swapping that sucker out with something that is dynamic
Wes Bos
Scott the Mux Love Fest. Cloudflare Stream, we said Node four k.
Wes Bos
go down the route of doing it yourself, like like, where do they go? Right? And this actually came upon a a question that we had from from well, it it kinda came 2 ways. Right? Like, first of all, And, usually, they those are dotts files, which drives me nuts And Cloudflare's that they just say. Like, if you can't access our m three u eight, then it's not a big is so good. I recently, and the bandwidth on Cloudflare r two is free.
Scott Tolinski
She's always telling me about Bunny.
Scott Tolinski
deal. Yeah. I will tell you that,
Wes Bos
But I think that you're a you're a ways away from being an enterprise customer, I think.
Wes Bos
extremely good.
Wes Bos
not, like, time limited. I don't know. I gotta dip into it a little bit more, but it seems
Scott Tolinski
And, honestly, Dave's a really cool guy too. We got to hang out at
Wes Bos
be able to you could probably use this just to transcode and then download the chunks yourself. You know? Yeah. I bet. And then some some transcoding services as Wes, like Mux, they'll just do it on demand as Wes, where you can upload a file and you can immediately start streaming it. They must have some special logic around, View stats is another another really interesting one as well if you wanna know how many people are are watching it or, like, where in the video are they
Wes Bos
to be able to run JavaScript
Wes Bos
Bunny It's the one I sent you. Polycapture.
Scott Tolinski
I see that there is, like, a full API.
Scott Tolinski
The pricing seems pretty decent, project. And I've never had that with, I've been hearing about Bunny from my daughter.
Wes Bos
So, you know, like, Cloudflare is kinda taking over the whole AWS HGTV like, you just entire monitor, can be a specific application on your computer, yet? and stitches them together.
Wes Bos
on here. People use it to stream hockey games or whatever,
Scott Tolinski
To me, if YouTube supports it, you gotta support it in your in your product. I agree. And, like, I watch YouTube in 4 k just sitting on my computer. I watch my YouTube in 4 k in VR.
Wes Bos
here I am on on Vimeo. I'm just looking at moving mine off of Vimeo because I was using the $200 stuff that you can skin any way you want. And there is a Winamp skin for MediaChrome,
Wes Bos
minutes of video streamed. So if everyone starts using 4 k, you lose some of the quality.
Scott Tolinski
nothing.
Wes Bos
So Bunny also rolled out subtitles is another one. It's
Wes Bos
as, like, more affordable and more approachable. I think multiple inputs at once. And, yeah, the files that come out of that thing are huge, but I I kinda don't want it any other way because
Wes Bos
Yeah. Although, many players will be able to adjust Amazon spec. It's it's actually kinda funny. If you if you create an access link on Cloudflare r two, it has, like, VOD, which means video on demand. Mhmm. And that will chunk it into into many ones because you can also have a m three u eight for live streaming, which is Scott's hockey games, Most of that $10 is because I my free courses are also streaming on there. So another option I could do is simply just
Wes Bos
a month CDN Cloudflare offer free bandwidth, theoretically, YouTube could run on Cloudflare r two for free. You know? And they're not gonna let that happen because you'll see that it's it's, like, a little bit blurry for the 1st 2 seconds, and then it it gets much better. And what's happening there is it's it's testing your, are they watching? Like, we can go into our Spotify stats vanilla JavaScript. It works in HTML.
Wes Bos
stream the free ones from YouTube.
Scott Tolinski
quite a bit less.
Wes Bos
from Mux, and they said they are it gave you, like, a Wes for the 1st 2 seconds, and it goes, oh, you downloaded that pretty fast. You got some fast Internet there. So then it goes, okay. We're gonna bump you up to render last year. Oh, yeah. Lot of fun. Yeah. Yeah. They're they're a good company, and and, like, as much as this stuff costs and, like, it's fun to go down the route of, I I they have they have offered me, like like, tons of credits and whatnot.
YouTube video encoding
Scott Tolinski
I I hate this in real life. But dynamic ad insertion,
Wes Bos
yet. Project got kicked off of YouTube, YouTube DL, and then they came back.
Scott Tolinski
Yes. And then, again, if it's struggling,
Scott Tolinski
masking Because the m three eight u is not a media file. I think that is something that is
Wes Bos
I forget why, but now it's it's under YTDLP.
Wes Bos
they actually are doing this. They're doing exactly what I was asking, whether they're just hosting it on Cloudflare themselves, and they're processing it and whatnot.
Scott Tolinski
6 or 7 different resolutions. Right? Yeah. So The m 4, Node, I don't know if you saw this on the m 4 distraction tip. The screens are not glossy, shiny anymore. Yeah. That's I want that.
Wes Bos
and then those point to additional m three u eight files that have the chunks in them for each of the resolution bitrate combinations.
Wes Bos
the it's still still less, but but not nothing. Yeah. But that's just a kind of an idea of of that. And the the other thing that we're not talking about here is that if you are not where if you stream developer content, I don't even know what the the whole but, like, we talked about this probably 4 years ago on the podcast. You Node? Now it doesn't support 4 k,
Wes Bos
There's no bandwidth cost. You simply just hold. You pay to hold them. So the conversation, I was like, I was like, can you just use this for streaming video? I know Cloudflare has a stream product. I know that Yeah. There's mux and whatever. And I'm not saying I'm gonna do this because this is is kinda hard. Although,
Wes Bos
video will take And Scott put me onto this app that was launching soon But do you you saw that somebody got a m four, and it's it's much better on there? Because, like, the No. I'm not. Show that. It's, like, twice as fast. No. Oh, yeah. See it. Yeah. I'm waiting for the m five.
Wes Bos
So what needs to happen is you need to host these chunks a lot of people are like, they're gonna shut you down, or they're gonna they're gonna try to they're gonna try to get enterprise sales on you. Does my concern too. Yeah. And it certainly is still a concern because it could happen. But, like, they had they have a blog post that says, we explicitly declare that you're allowed to do this. I think the only caginess they have around it is that people abuse it. People put copyrighted material because if you have Awesome. Alright.
Scott Tolinski
into YouTube. So I would finish my course. I would export it as 4 k. I would drop it into YouTube. I would put it into a playlist. And then once it was done processing, I would tell YouTube DL, download that whole playlist at the highest resolution possible. And next thing you know, I have
Wes Bos
I have, like, a m one Mac. It's pretty fast. I kinda want the m four now that for for some of this. But, like, an 8 minute Amazon Wes three. You can put them on Cloudflare r two. Right? Like, all of the big,
Scott Tolinski
to save me time for level up tutorials. It's like It it so what I would do is, yeah, you can drop a whole folder Around, like, details and edges, things get kind of, like, blocky and digital looking. And it isn't, like you said, that the resolution is bad. It's just that there's not enough bits in in the video itself.
Scott Tolinski
And this is cool from a technical perspective for me because
Wes Bos
It's it's making what are called variants. Right? The the different versions. And and your users in Germany or Australia are gonna have a little bit of slow
Scott Tolinski
Yeah. Totally.
Scott Tolinski
Yeah.
Scott Tolinski
Oh, looks like it is still maintained. I used to use YouTube DL or YouTube, essentially, as my video
Wes Bos
Yeah. I want that as well. That that seems pretty sweet. I can't justify I just can't fathom No. Unless you're doing, like, FFmpeg. And and even then,
Scott Tolinski
bump you back down. I think just about everyone has experienced this, especially Wes, faster Internet wasn't as available as it is today.
Scott Tolinski
And so that's a a motivation for me to wait.
Scott Tolinski
that's how it works. It's essentially, they're splicing a message, and there's a specific format for this type of message. We're not getting in the technicals here. But they splice in a message into that stream that then chooses to load the ad before going back to the m m three u eight playlist. So I thought that was super interesting JS because we're dealing in chunks here, it makes it really easy to insert and add in between chunks. Yeah. You can simply just swap out one of those chunks with a a different one. Because if you look at the m
Wes Bos
I'm I'm sure it's not that big of a jump. But, like, what else are you doing that you need it that fast? You know? I'll tell you what.
Scott Tolinski
Masking in DaVinci Resolve, especially, like, automated
Wes Bos
four k, and then and then you get the the better version of that.
Scott Tolinski
There's also another really cool thing that you you because, right, you have a playlist, you have chunks.
Scott Tolinski
super nicely compressed files that I can zip up and then give those to people to download. Worked really well. They're so good at it. Like, YouTube has its own They're the best. Yeah. Algorithms for doing this type of thing. But, also, Scott like, you have an issue, you
Scott Tolinski
compression software
Wes Bos
bandwidth that is needed. So that's sometimes sometimes when you start watching a video, your video into Yeah. If your user so that FFmpeg to be able to detect a month gives you 600 gigs But they they do this. You have to upload the user's thing, and then you gotta ingest it, and you gotta convert it, and then you gotta put the all the pieces somewhere.
Wes Bos
three u eight file, a 4 k video that's a minute long. Right? Mhmm. It will convert it into like, HTTP live streaming is not a web spec, So there's nothing in the browser that can do it. You need,
Scott Tolinski
Definitely was like a major thing to have video all of a sudden go super blocky all the time. And and maybe that, you know, a lot of people are still experiencing that.
Transcript
Scott Tolinski
Yes. Absolutely pivotal.
Scott Tolinski
Then, you know, YouTube revolution, than Mux is. Is it? Yeah. Plus, I tried to do the whole Amazon thing, but it it felt very rickety. And it's mostly because practically, what can you do in in 2024 video, like your normal video of a surfer.
Scott Tolinski
And the way people were primarily doing it at the time on a non, like, large scale, like, if you were just having video on your site, what you would do is you would encode
Wes Bos
in a WASM worker in serverless functions, and we've hit our fair share of
Scott Tolinski
Doing great. You know what? I it
Wes Bos
oddities that have have popped up there. And and Sentry has been pivotal in figuring out why those things don't work. So check it out. Sanity Scott I o forward slash syntax.
Scott Tolinski
just beyond the tech and, Me u eight. Yes. M three u eight. I'm just gonna I'm just gonna grab that and convert it. You can't. It's a it's a playlist
Scott Tolinski
video.
Wes Bos
and beyond Wes let's just say 2025. 2025. Yeah. Let's face it. We're there already, which that's crazy. Right? So if you are gonna be rolling your own, you're gonna need Sentry because you're gonna be hitting your fair share of bugs. I know figure out where to plug the cord in. You know? I got one of these bad boys sitting on my desk too. Was that Jackery? Oh, no. Anker?
Scott Tolinski
Then we got the video element for HTML.
Wes Bos
we run FFmpeg the Mux is not fleecing you, And they record to explicitly around the globe in their different data centers.
Scott Tolinski
So let's get into it. 1st and foremost, streaming
Wes Bos
both rolling your own streaming video, how how that works, as well as talking about a bunch of services that will help you out with it. My name is Wes Bos. I'm a developer from Node, streams a lot of video. With the as always JS also someone who streams a lot of video, Scott Tolinski. How are you doing today, Scott? Hey, man.
Scott Tolinski
is definitely a deep well that I have traveled many times before, but the landscape definitely has changed. So I'm really stoked to talk about this in general, they call it, blob storage. Right? Just store data, raw data. I will say that if you are choosing to go down this route of storing these blobs yourself
Scott Tolinski
You know, in the past, in olden days of web, you couldn't use anything other than Flash to play video.
Scott Tolinski
1 JS like, man, I even forgot o g v o g g format. Awful. Yeah. O g v and whatever. Firefox. So all the different browsers had their own different formats. You had to ship all those different formats to everyone.
Scott Tolinski
all that stuff, video streaming just kind of became the norm. And, really, you wonder, like, well, why can't every website including mine do video streaming? And the the answer is really that you can. So here's how video streaming works. It's a a format called HLS, which stands for HTTP Wes you're live streaming from a computer to an ingest server
Video player libraries
Wes Bos
the one that I've been using for the last couple of projects is Mediacrome, and that's from Mux.
Wes Bos
You import the library. That's it. And you run no more JavaScript past that. You simply just use the tags multiple versions, meaning that you have to first chunk up the video into with, like, coding videos, you wanna you don't necessarily care about the resolution so much, but you care a lot about the bit rate because
Wes Bos
it's it's like HTML.
Scott Tolinski
on video players I have used, loved and lost. How about that? Video players I've loved and lost.
Scott Tolinski
Yeah. There there has I could do a whole episode more than you might expect.
Wes Bos
that you need, and it will it will do things like you can have switchers. You can do AirPlay.
M3U8 files explained
Scott Tolinski
That's wonderful.
Wes Bos
which is the like, edge functions Nice. But
Wes Bos
second chunks.
Scott Tolinski
You load up Winamp, you got a playlist. Do you remember that? and you can do things like control access by location.
Wes Bos
which is, full circle.
Wes Bos
Yes. Oh, yeah. For sure. Winamp was, actually, the we're gonna be talking about MediaChrome, seems pretty good, CDN sits in front of your r two bucket, and that, again, that is allowed via the terms of service.
Hosting video chunks
Scott Tolinski
and then it sends it to media convert.
Wes Bos
you may put them in a Cloudflare r two product, and then you may put the Cloudflare CDN in front of that because that's the 2nd step to this is Mhmm. You can put your files in a bucket somewhere, but that's not going to be fast across the world. You put them in in in Virginia,
Scott Tolinski
Let me tell you the workflow. So this is the Amazon suggested workflow if you were doing this by hand. You have 1 bucket for your source.
Scott Tolinski
then you have a Lambda function that looks into that bucket, It was very difficult,
Wes Bos
on Cloudflare
Wes Bos
you you really have to be able to generate those things dynamically, especially if you're trying to limit access control.
Wes Bos
you you need to be able to And it just somebody has done the work of building such a flexible player. Huge project.
Scott Tolinski
with your with your folder structure because it can get out of hand. You have all these different versions. You have all these different chunks of videos. You have different videos individually.
Wes Bos
they use And it works in React and Svelte and, the other thing, when people watch of bandwidth. I these companies gotta start giving free bandwidth because now the the fact that Backblaze and Right? And a year to just hold those. And and that's not a lot if you have a single course. It is a lot if you have, like, your your blue sky or Twitter, and people are uploading
Scott Tolinski
So you have a source bucket,
Wes Bos
JS as much as you can download like, doing it in parallel, You might be thinking, how is that possible? So
Wes Bos
to store these, so Cloudflare r two is a place to store them, It is allowed. Even though they have a competing stream product, Tenuto, they're gonna have slow streaming. Right? So what you can do is you need you need to put those files minute viewed is is massive gains. Totally. So I'm sure people are always looking. And, also, like like, Warp, I think. Like, you got Man.
Wes Bos
And every time you have a a course or update a video, just run the script on your computer and then and then upload the output to it. But if you're having users
Wes Bos
like, as much as you can, According to their terms of service, they even updated it to say this, as long as you
Wes Bos
infrastructure
Scott Tolinski
or the these you have to be very organized
Scott Tolinski
That converts it I think Bunny is gunning for that that whole space as well. They're coming for the number Node spot. Do you remember that song, Ludacris?
Scott Tolinski
After it puts it into the other bucket, it writes to a database where the locations for those files are, and then it puts it all behind a CDN. So,
Wes Bos
Bunny,
CDNs for video delivery
Wes Bos
per gig per month, meaning that
Wes Bos
where,
Wes Bos
That's 90 hours a
Wes Bos
on Cloudflare, let's say you have a course with 30 15 minute videos. Right? That's 7 and a half hours of content, files or store, working on a new program Let's talk about specifically Cloudflare, because I think that this is what got me going down this whole rabbit hole, which is Bandwidth on Cloudflare is free.
Wes Bos
that needs to be uploaded.
Scott Tolinski
that much every minute to you. I I wonder how that compares to Mux,
Wes Bos
as well, which probably at a mega like, you're a you are a CBS.
Scott Tolinski
for minutes
Scott Tolinski
minutes uploaded to Mux. So let me do that math here.
Wes Bos
So
Scott Tolinski
Not for for regular folk. Totally. Yeah. That's where I landed on. It's like, this is not for me.
Scott Tolinski
AWS has, like, a service specifically for this, elemental media convert. Right? So, like, they have a service that's completely designed just to handle media conversion at this at this scale. I and I did the math on it. It's much more expensive Moving moving those buckets would be easier.
Scott Tolinski
which for storage is Well 0.003¢
Wes Bos
Yeah.
Wes Bos
Steve, web component for playing over everything. You Node, it's not like a CDN. They don't use Bunny Stream. That's a product.
Scott Tolinski
I can give you some real data here.
Scott Tolinski
LevelUp tutorials
Wes Bos
of 4 k video for $2.18.
Scott Tolinski
for the entire course base for Vercel up tutorials they they do protect those m three u eights. They don't want anybody just grabbing their kind of process.
Wes Bos
16 gigs
Wes Bos
So if you take that 30, 15 minute videos, 7 and a half hours of content, 5 minutes to to chop up into I'm not gonna say what it is, but it's a it's a set of
Wes Bos
Mux does it per minute, so that's gonna cost you about a buck 35 all of the sizes for you, behind these types of things because, first of all, I'll point to a Twitter thread called PolyCapture.
Wes Bos
10, 15, You don't even need a framework for it. So, yeah, it's just a a really nice, Let's get into Wes VTT file,
Wes Bos
it's gonna cost about 25¢ a month, and you have to you can just leave the files open You can do thumbnail preview, is like like, I'm on Vimeo, and that's not very movable.
Scott Tolinski
man, I I could I could spend a whole episode on different Yeah. Remember JW Player or JW Player Plyr, p l y r,
Wes Bos
it, it costs you 5¢ per hour about $3 of video watched. So if somebody watches that entire 7 and a half hour course and this is kinda how I how I look at it. Right? My courses are
Wes Bos
and it costs you, what, 5 5¢ per hour, $4.50
Scott Tolinski
or $0.003, which Bitmoven is I found to be a bit technical.
Scott Tolinski
total noob, in terms of all the services. So when you start to connect, like, 8 different services together, I'm like, oh, boy. Too much for me. Yeah. Well, you should look at the, the graphic of M three u eight. Yes. Oh, dyslexia.
Scott Tolinski
player Scott JS, I think.
Wes Bos
you have to now pay for a server month pro plan from Vimeo, and they came
Wes Bos
you do video on demand. Oh, yeah. And it's like, yeah. Upload it to s 3, put it in a Lambda, then throw it to the BDA convert, then put that on CloudWatch, then that goes to EventBridge, Steve and Aaron, they have a bunch of courses as well. They did 15 terabytes some sick picks and shameless plugs. Yeah. My, sick pick is gonna be PolyCapture app. So, So let's talk about bandwidth and and hosting. So once you actually have these dotts chunks, 7 and a half hours of content is probably going to be about process needs to take care of.
Wes Bos
And and that server would be easy. It depends on, obviously, how much video you have, but
Wes Bos
to to to run that compute, I guess this is more of a compression thing, but I remember when I used to download, like, Family Guy in the Simpsons, I was always, like, marveling how much smaller the file sizes giants out there have products that will allow you to simply store That's I really like this about Mux because they I I did the math on Mux as well because Mux takes the hard part, which is And it's a web component,
Wes Bos
charges you 1.5¢ And every time that we we do that before we send it out for transcript, that runs through FFmpeg anywhere from 7 hours to 40 hours.
Scott Tolinski
Yeah. It is for 6000 minutes of video, which let me tell you JS a lot of courses of video. A 100 hours.
Wes Bos
seven and a half hours of content.
Scott Tolinski
streamed. So $33 The the solo video guy trying to get his website Mhmm. Working nice.
Scott Tolinski
0.3¢
Scott Tolinski
that that is the one. And in the past, there's been, like, a 100 different playing player libraries. In fact,
Wes Bos
R 2, which is Cloudflare's storage product, because dotts is also TypeScript. And if you search for
Wes Bos
just in bandwidth.
Wes Bos
a library to be able to, scripting in bash is painful.
Wes Bos
So let's talk about actual players. So you cannot take a m three u eight and just pipe it into a video element, because
Scott Tolinski
and then you just get the m three u eight file, and you just plop that in your player. To go. Yeah. Yeah. So, in smart crop
Wes Bos
And you'll look at it, and it that's if it's a 7 and a half hour course, it's gonna cost you 43¢ if they watch every single minute of it and and don't skip ahead or whatever.
Scott Tolinski
A 100 hours of video.
Wes Bos
up to 100 and 100 of dollars a month for these really GPU heavy
Wes Bos
really, it's it's significantly more, but really not that much if you're thinking about
Wes Bos
Let's talk about the actual cost So if you want to build your own m three u eight file, you need to transcode
Scott Tolinski
per minute.
Wes Bos
trying to do all this, like, crazy math. I don't know how many gigs I'm gonna be using. You know? I don't know how many people are gonna be watching.
Wes Bos
how Amazon suggests
Wes Bos
that
Wes Bos
running the FFmpeg on your own computer,
Scott Tolinski
JS. So And you'll see They don't even say anything about 4 k. Seems wild that
Scott Tolinski
but it has been since version 6. So this is HLS is an Apple technology. So that makes sense that they would have it in there. But, yeah, you have to use HLS and you've always had to use HLS, Yeah. Altogether. For sure. Sick.
Wes Bos
let's let's break it down into to how how these things work. And we did do a whole show on I figured out that you can host video files on Cloudflare r two,
Scott Tolinski
so
Wes Bos
month, 43¢ for somebody to watch 7 and a half hours of video.
Scott Tolinski
It cost me $18
Wes Bos
servers that can can do it very quickly. So, again, that's another thing. It doesn't matter. It doesn't need to be much faster or not. Yeah. And Amazon, Yeah.
Scott Tolinski
And then a month. And then because Man. No. I don't. Oh, yeah. That was kinda late stage Ludacris. Not really like Ludacris rollout prime or anything like that. Rollout is
Wes Bos
Yes.
Cloudinary for video
Scott Tolinski
And then with just the URL, it transform and convert it into I am not using YTDLP
Wes Bos
with React, which is we've had them on the show as well. Yeah. There's also Bitmoven,
Scott Tolinski
for video specifically.
Scott Tolinski
vertical video.
Wes Bos
these, like, TikToks that like, they do programmatic video. Yeah. This is a huge thing on TikTok. They'll take, like, a Reddit story, and they'll take some you don't lose it because it's it's always just recording the window and not what shows up on your your display.
Scott Tolinski
that MediaChrome.
Scott Tolinski
to stay locked on to a subject of which is the surfer for vertical video. So they have the 16 by 9, and then the vertical video is just kinda panning around. And they're just serving
Scott Tolinski
some of these other ones. I have, something interesting here. There's there's, like, you get a lot of the cool transforms and stuff. They have an example with a 16 by 9 and you can have it as a light too. We use it outside with our projector.
Scott Tolinski
we mentioned, we have not actually mentioned them throughout this episode. Cloudinary.
Scott Tolinski
Also, I'm an AWS
Scott Tolinski
that looks nice and interesting. So I have not used Cloudinary all of these videos have been up for a long time, they're not being encoded very much. So it only cost me a dollar this last month to encode all of my videos because they've already been encoded and stored and encodes as you go, and then $13 only because I finally got it dialed in. I know exactly I have it all set up. I basically just open OBS and click button,
Scott Tolinski
they have a full video API now. So, which is a a pretty cool video. He goes pretty in-depth on some edge casey stuff and and gets really, like, into what did Deno two promise and did it,
Scott Tolinski
when I tried it out several years ago. So I would be interested in knowing what it's like now.
Scott Tolinski
But given how nice the product is to work in on Yeah. On photos, I kept imagine that would look pretty nice. $224
Scott Tolinski
Yeah. That's an option. Cloudinary also has a I know. It's it's it's really super reasonable. And let me tell you why it's so good. You don't gotta worry about storage or ingest. You don't have to worry about saving things, database. You upload it, to store that.
Wes Bos
a Remotion is another one that we we didn't talk about. They're not really in this space, but you can programmatically make and it does exactly this. And and it just freaking works. And it like, save a m three u eight file, like, pretty much anything you can think of. There's either a plug in for it or it's built in, and you simply just use the,
Wes Bos
a car's axle or something like that. Player just jumping through Minecraft. Yeah. Yeah. They'll give you 2 videos in 1 story that are totally unrelated, but you're like, this is hitting all the receptors in my brain right now. I think that's how a lot of these guys make this this stuff. I don't know if it's specifically with Cloudinary, but it's this chopped it up into all those multiple pieces and for multiple resolutions. It probably Wes if you only do, like, 4 k, 10 80, 7 Wes. But if you wanna go all the way down to, like, 3 60, it's gonna be around that. Yeah. Now you have so you have 16 gigs of video.
Scott Tolinski
AI much, much smaller.
Wes Bos
video of some guy in Pakistan, like, repairing a
Scott Tolinski
media so you can automate That was a good one. Yep. A big fan of, Ludacris.
Scott Tolinski
They talk about having programmable has
Wes Bos
That is really pretty fancy. That's cool. I think that's how a lot of these
Wes Bos
videos of files once you have,
Bitmovin video platform
Scott Tolinski
it didn't feel like Mux Easy, and it didn't feel a few different versions of your video.
Wes Bos
or something.
Scott Tolinski
That's crazy. Technically, I I can't imagine writing something like that, so I'd be interested 6,000, Yeah. It, like, really, I'm sure it's very solid, but in my experience, it didn't feel
Wes Bos
move to some of these other services that just slurp up from a bucket and then transcode from for you. Yeah. That's a good point.
Scott Tolinski
Cloudflare Stream Easy.
Scott Tolinski
that is then on the fly encoding the video to the different formats and then serving that.
Wes Bos
bigger operation and you're pinching them because even, like, half a cent per on servers around the world.
Scott Tolinski
I I didn't really like using it when I tried it. It could be different. It's many years later.
Wes Bos
being able to move from one to another I looked into it, and and then that will be available I could pretty easily hosting big zips and whatnot, but this is just specifically video. So It's it's really hard to to justify
Scott Tolinski
And so, therefore, it's like, well, live streaming.
Scott Tolinski
if those ones are cheaper for me, then I'm probably not going to bother. Yeah. Yeah. That's it's probably worth looking at if you've got a bigger
Scott Tolinski
Yeah. Before we get out of here, there's some other features that we didn't talk about, like live streaming. And, like, live streaming is is kind of like,
Scott Tolinski
like is not only my favorite player by a long shot.
MediaChrome video player
Scott Tolinski
Obviously, if you're hosting it on CloudFlare, that's not something you need to worry about. So you had mentioned that there is a, like, specific video streaming service that Cloudflare has. And you know what? It used to be
Wes Bos
but you certainly are going to love using them.
Scott Tolinski
Yeah. It takes care of all the little things. And so, definitely, if I were saying anything,
Scott Tolinski
iffy. It's called Cloudflare Stream. And it was only iffy because it was like you you drag things into the UI, you copied and paste or whatever. The API was, like, nonexistent.
Scott Tolinski
element.
Scott Tolinski
And there are endless edge cases with a video player, and you get into a situation
Scott Tolinski
and it's not like a iframe embed or anything like that. It just it works. And it work we use it on syntax websites. It's not just video as well. Right? It works for audio. We use it just for audio. Yeah. I didn't know this. You can load YouTube up in it now. You can load Wistia or Vimeo up in it. So I didn't know Node. Or Spotify audio. There's a Spotify
Wes Bos
That's interesting. You can embed a Spotify right in the page. Yeah. It's pretty cool. It's it's
Wes Bos
I I have a talk coming up. I'm like, you don't have to like writing web components, are using It's just by a a dev, Bos, or or Mac dev out of Germany,
Scott Tolinski
Next 1, CDN. Like, what do you do about a CDN? I've I've done the Amazon route putting CloudFront in front of video before.
Scott Tolinski
And they're like, oh, yeah. Chromecast is broken in these browsers. I'll get around to it at some point. And and, like, then you're you're that's that's what you have to deal with. What am I gonna get in there? I'm gonna submit PRs to this complex video player, a video solution, which it was one of the ones I tried out, but it was a little immature audio video life cycles, whatever that means. Automation for video with video flow,
Wes Bos
You 2 to 4 second long chunks, and each of those chunks will often it's not always the case, but often those chunks will have multiple resolutions and multiple bit rates. So you'll probably have a 4 k one with a specific bit rate, and you'll have an, 10 80 p one with a specific bit rate and So to create these m three u eight files JS as well as the chunks themselves, you can the tool that everybody uses is called FFmpeg.
Scott Tolinski
It's probably my favorite web component by a long shot. You know, one of the big things that I have noticed with playing a video player library specifically, like I said, I've used so many of them, is that so many of them are maintained by a single person somewhere.
Scott Tolinski
Wes, MediaChrome.
Wes Bos
know? Yeah. It's the the bit rate is extremely high. I've been been playing with this other recorder.
Scott Tolinski
where you want, let's say, Chromecast.
Scott Tolinski
It just works. It works super well. It does everything that it's supposed to do, and I I don't have any bugs with it. You have, like, full control over all the CSS
Transcoding video with FFmpeg
Wes Bos
line transcode TypeScript
Scott Tolinski
or or or you dial down the bit rate with compression or otherwise.
Wes Bos
video files on your on Mac Finder, it shows you TypeScript files.
Wes Bos
the quality of the video, the the bit rate of the video also, and and and the the codec and all that stuff does as well. But, generally, with my, So I would put a powered by Mux or whatever, and then you could get things. So it's that's it seems like a pretty cool program.
Wes Bos
And those chunks
Wes Bos
entirely But then, like, if you think about, like like like, Netflix, you know, people watch 3 hours a day. Mhmm.
Wes Bos
as well. Sorry. That will only output 1 size. You have to run it multiple times and then concatenate them all into a single m three u eight file. I wrote a
Wes Bos
define just to simply hold those files, Mhmm. Because now I have to, like, reupload everything to another platform. But if I had these if I had all my source files in, like, a bucket somewhere,
Wes Bos
HLS
Wes Bos
You know,
Wes Bos
script just because what it does is it lists the resolutions and bitrates,
Wes Bos
when you start to go down in bit rate, things start to get fuzzy, and and the thing that goes fuzzy first is text. Yeah. You know, you might you definitely might notice this.
Wes Bos
resolution doesn't
Wes Bos
are you generally will take like, let's say you take
Wes Bos
FFmpeg is this just wild open source project that, like, many $1,000,000,000
Wes Bos
play playlist type,
Scott Tolinski
colors that should be solid potentially waver a little bit and be, like, 1 or 2 colors that are kind of blocky, if not the same, especially around, like, shadows and stuff like that.
Scott Tolinski
were Yeah. Than, like like, regular TV shows. And it's because, like, the colors in them were were much simpler, and they compress a lot more. Yeah. Totally. Yeah. Stuff's not moving. Just big blocks of color. And you'll see it too. Especially, you'll see that if you dial down the compression
Wes Bos
I much rather programmatic
Wes Bos
120 and their prices are
Orchestrating FFmpeg with JavaScript
Scott Tolinski
Yeah. And you'll frequently see this. If you're paying a service to do this, there's there's companies like Bitmoven that, like, primarily ingest or AWS SMVOD flows we'll talk about. But the way that this typically works is that these are being done in just kind of like a queue. I'm gonna upload this thing, and now here's, like, a queue of all of the different,
Wes Bos
I'm not doing the transcoding in JavaScript, but I'm using JavaScript just to sorta script it, which is good.
Scott Tolinski
different resolutions and versions that my Mhmm. Transcoding super easy and reliable.
Wes Bos
Orchestrate. There you go. Yeah.
HLS video streaming explained
Scott Tolinski
address.
Scott Tolinski
then you have seen what could be considered a playlist
Scott Tolinski
extension, smoothness, playback, success, viewer experience.
Scott Tolinski
for chunks of video.
Wes Bos
It's just text. Right? It's just point it's like an RSS feed. It's just pointing to where the pieces are and describing the pieces inside of it. It's Winamp.
Scott Tolinski
So if you've ever I I Node, I I don't wanna put myself out here too much, but if I was streaming hockey games that were not in my my area, and I'm not gonna say legally, but I was just streaming them, there was actually a website that would just post all of the NHL apps m three eight u's, and you would just copy those
Scott Tolinski
and paste it into VLC.
Scott Tolinski
with chunks inside of it. And, again, other players such as VLC or anything can read this just like an HTTP
Scott Tolinski
often misconstrued
Scott Tolinski
by people who don't do video streaming. They see, oh, wait. I'm I'm loading a video. It's an m three eight u. I'm gonna grab that m three eight u. I'm gonna convert it.
Scott Tolinski
If you've ever seen a dotm3u8
Video encoding queues
Wes Bos
and or, companies are built on top of. But there is a flag for it that That Node is kinda interesting because if you're just doing something like I'm doing, which is you have courses.
Wes Bos
That's why you upload a video to YouTube. It takes so much longer to, like, process than if you're uploading them to, like like, I upload a TikTok and a YouTube short at the same time,
Scott Tolinski
downloading videos off of YouTube. If you've used YouTube DL, there is a command, and I'm trying to see what it is for options, that just simply lists all of the available versions.
Scott Tolinski
in there. There's a lot of versions, really nice things where you can track He said the announcement's coming soon, but there's already a page for it. Oh, well, shout out to Mux. They've always been, good good friends of us, good friends at LevelUp.
Scott Tolinski
And there is a lot
Scott Tolinski
YouTube DL, a great project for, I know it's FFmpeg because you can just stream info in. I was actually doing that when I was writing my own screen recorder with FFmpeg.
Wes Bos
That's interesting. By the way, are you not using
Wes Bos
the TikTok is ready in, like, 2 seconds. Mhmm. And the the YouTube takes forever, and it's because they're making I don't know, how many how many possible copies. Do you wanna know how many?