Streaming Live TV from a HDHomerun to a Web Browser using FFmpeg

Streaming Live TV from a HDHomerun to a Web Browser using FFmpeg

Welcome in this video I'm going to talk about streaming television live television from an HD homerun to a Web browser, and I made a previous video where I streamed from an I P camera to a Web browser

So this is a picture of that, some video, and this will be very similar to that You may want to go back and watch that video I going to try and cover most of the same things But, you know, I may forget what I have here is I have I'm on my computer and I'm sshed into a Linux machine and this video is mostly for more advanced users I'm not going to include every single detail, but if you have questions, put him in the comments and I'll try and answer if I can

What I have on this Linux servers I have nginx Web server installed and then in the /var/www/html folder I have this indexhtml, and within that I have this text here, and this is some html and Javascript that I pulled from this site, and this allows your stream to work on safari, chrome and firefox I had a and I showed it in the other video I guess I could pull it up here

If you are doing just on safari, you can use just this tiny little blurb here, and I'll put all this in the description or in comments or whatever, so you can, you know, copy and paste it But this here is everything you need on your HTML page to display the video And the most important thing to change here would be this address two things We have the Web browser here, and then we need to run a script on the Web server And I have that in this live directory

Go here and have the streamsh So I will cat that so you can see it, and this is still set up for the IP camera, but I want to set this up for the HD homerun So what this does is this creates a playlist here and it creates files, and then it serves those up to the Web server And these settings here, this hls_time says, Make the clips ten seconds and then this says, make ten clips and then rewrite the old ones, and I'll show you this a little more when it gets started up

But we need to figure out which stream we're going to encode So if you open up your HD homerun, extend or hdhomerun or hdhomerun extend I'm using an extend and I'll put it like a description to an extent And if you buy one with my Amazon affiliate link it helps me a little bit and doesn't cost anything extra So you'll go to a web page of the I p address of your HD home run

I don't have this software Let me see if I have it on here having all my Linux machine You can get this installed on Mac, too But if you type hdhomerun_config and then discover this will show your HD home run IP address and I have two of them on my network So I'm at 192

1687188 And you go to the channel lineup here and you could hit this detect channels if you haven't run it already And you'll see all the channels here, okay? And we'll figure out which channel we want to stream

So I'll stream this eleven dot one and you'll see what I hover over this It shows in the bottom Left hand corner has an address I'll just say copied Link, and then I'll go into my server here, and I'll open up my streamsh file

So streamsh And then I'll replace this vidsource with the url from the HDhomerun So now I will save this all type control-o to save this and then control-x to exit out So the streamsh is all set up and now run it If you're not familiar

Like I said, this is an advanced video But, you know, I would like people to learn So if you're not familiar with scripts in the shell to make them executable you need to type chmod +x and then streamsh And that makes him executable

And I've already done that But so now I can just type /streamsh And I have another terminal window here in the live directory So if I type ls, you'll just see stream here

Let's go back here Did not like the encoder You see, if I can fix that, I'll just change that to aac You will see if that works Oops

Okay, so that works I just had to change that That libfaac to aac, and then we'll look in this directory here, you'll see it creates a playlist This my streamm3u8

And then it has my stream1ts mystream2ts So it will create these mushroom one, two, three up to ten And then when it gets to ten, it will overwrite the one and make eleven and then over right to make twelve And I'll just keep doing that

So now that we have this going, we could go to our Web browser and I'll refresh this And we have live TV here We'll have to hit start And now it's playing You won't hear the audio because it the screen recorder I'm using doesn't do the audio So we can also go into Let's see Chrome here

Have it running there and we'll go to Firefox And now I have it running in three different browsers So you could, you know, watch this on your your phone, your android or iPhone, either one, it will stream So a couple, another thing we can do here So let's go back into the stream and I'll hit control C to stop it

And we'll see that all the files it created, so And if you haven't SSD this could, you know, wear out your SSD eventually, I don't know, because it's always writing files, So let's remove these, and then we'll go back into our streamsh So I'm running the HD homerun extend and this has transcode capabilities So if we go to the main page and then go to transcode configuration, you'll see this default transcode profile so we can select one of these Or you can just choose one in our URL

Let's do internet240, and I'll show you how you can set that up So if we go to vidsource here and at the very end we can type question mark and then transcode=internet240 And then we can go to our video here and we can remove all of this and we'll say the -vcodec copy So when we transcode in the internet240 this will, transcode into mp4 video and but the audio is not and before, So we need to leave the audio here so it converts it to aac But we'll just say -vcodec copy for the video

So this will keep it from having to re-transcode or re-encode the video using ffmpeg so it'll make it a little bit more efficient Now we will save this and exit and then we'll see if I have this OK, we'll run it now And this will take a second for the playlist to be created That seems like it creates one of the streams And then it creates the playlist for the second one

So it takes private ten seconds to get started Okay, we'll go here and we refresh Okay, Now we have a smaller version of it Which we very efficient, so you could pull this up on your iPhone or your you know, your tablet and won't take much band with And it's very efficient because the HD home run is doing the transcoding

So the one I like to use a lot 240 is good If you're like watching on a phone, you want just the the best optimization But internet540 is pretty good It's pretty good qualtity and it compresses it quite a bit I I think I tested once it compress it about six times smaller than standard because the standard stream will be an MPEG2 stream and this is impact for, so it's a lot smaller and you are losing some quality But if you're not super concerned about the quality of the video, the internet540 is a good option

So that's the basics of streaming from a HDhomerun to a Web browser using ffmpeg And if you have any questions, please live in my comments I know it may have left some things out, and I recorded that other video on doing the IP camera I'll put, like, a description of that, too And it's very similar to this

But I may have said different things in each video, so you might want to watch it But if you like this video, please cook Like if you haven't subscribed channel I would appreciate if you could do that, and thanks for watching until next time Good bye