Jump to content

Hosting .ts video files on my webserver

babadoctor
Go to solution Solved by vorticalbox,

Maybe using socket.io to stream the file to the browser? 

So I have ~2tb of .ts video files that I want to be able to host directly on my webserver, so I can watch the videos in my browser.

 

I managed to be able to access the videos using npm's http-server, but it only allows me to download the videos, unless I use a program like MPV to view the videos.

https://github.com/indexzero/http-server

 

This works, but it won't allow me to view the videos in the browser.

 

I don't want to install plex

 

And I really don't want to re-encode 2tb of .ts video files into mp4 with ffmpeg .........

 

Does anyone know how I can do this?

 

I know .ts file is a form of .mp4, but...

 

This is what ffprobe returns: (it's h264 but with .mpegts file?)

 

https://hastebin.com/ifufuvuhuw.pas

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

Why don't you wanna install Plex..? Seems like by far the easiest way to do this.

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, DtrollMC said:

Why don't you wanna install Plex..? Seems like by far the easiest way to do this.

The reason I don't want to install plex is because I want to make it accessible by visiting a web domain I bought.

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

I don't see why there wouldn't be a way to link the domain to that IP. Just seems to me like there are FAR easier ways to go about what you seem to be doing.

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, DtrollMC said:

I don't see why there wouldn't be a way to link the domain to that IP. Just seems to me like there are FAR easier ways to go about what you seem to be doing.

Okay, well what are the easier ways besides plex?

 

I have other reasons for not wanting to install plex too.

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

You don't have to re-encode, you just have to re-package from the .ts container to .mp4 container with hinting for fast playback

 

See https://rigor.com/blog/2016/01/optimizing-mp4-video-for-fast-streaming

 

if the video is already h264 and audio is already aac or something compatible with mp4 files, then you can simply use copy for both video and audio and you just change the container... takes seconds per file.

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, mariushm said:

You don't have to re-encode, you just have to re-package from the .ts container to .mp4 container with hinting for fast playback

 

See https://rigor.com/blog/2016/01/optimizing-mp4-video-for-fast-streaming

 

if the video is already h264 and audio is already aac or something compatible with mp4 files, then you can simply use copy for both video and audio and you just change the container... takes seconds per file.

 

That's good to know :)

But it's still a problem, because I still need to create a new file and delete the old one, which would be really taxing on my hard drive... (not that it's in the best state, mind you)

 

Do you know if it's possible to serve .ts files in the browser? (hopefully without an extension)

 

Or maybe have the encoding done client side via some sort of javascript?

 

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

If the hard drive(s) is/are so bad that such an operation would "tax" them, they'd basically be dying the next day. Drives are meant for reading and writing and that operation is just that.. read chunk, write chunk in new file.

 

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, mariushm said:

If the hard drive(s) is/are so bad that such an operation would "tax" them, they'd basically be dying the next day. Drives are meant for reading and writing and that operation is just that.. read chunk, write chunk in new file.

 

It's not that the hard drive would fail if I made them render all of the video, it's just that I don't want to ruin it's lifespan...

 

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

You won't ruin any lifespan.

Mechanical hard drives have practically unlimited life, they don't wear out in proportion with the amount of data read or written. If anything, the risk of failure increases with the number of times the drive starts up and gets up to working temperature or cooling down (so the more reboots of your computer or start up after some period, physical changes in the mechanical drive state can affect reliability). The initial pulses of electricity going into the mechanical drive, the "push" required for the drive motor to start spinning the discs inside, the super tiny expansion of the discs inside the hard drive as they heat up, these are the failure points in a hard drive ... not the reading and writing of data.

 

SSDs have some maximum amount of writes during their life, for example 40 TB for a 60 GB drive, 70-100 TB for a 120-128 GB drive, multiply for bigger sizes. Reading files doesn't cost anything, just writing data into the memory chips causes some wear and tear in the memory chips. 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, mariushm said:

If anything, the risk of failure increases with the number of times the drive starts up and gets up to working temperature or cooling down (so the more reboots of your computer or start up after some period, physical changes in the mechanical drive state can affect reliability). The initial pulses of electricity going into the mechanical drive, the "push" required for the drive motor to start spinning the discs inside, the super tiny expansion of the discs inside the hard drive as they heat up, these are the failure points in a hard drive ... not the reading and writing of data.

I have heard this argument many times, and google claims shutting down a hard drive/ turning it on is not a big hit on performance; although I don't ever shut it down...

 

https://superuser.com/questions/17228/is-turning-off-hard-disks-harmful

 

 

 

 

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

Maybe using socket.io to stream the file to the browser? 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, vorticalbox said:

Maybe using socket.io to stream the file to the browser? 

This is interesting, since socket.io is a node.js application, maybe it is possible to implement this into http-server?

 

 

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

11 minutes ago, babadoctor said:

This is interesting, since socket.io is a node.js application, maybe it is possible to implement this into http-server?

 

 

Yeah no reason why you can't. I use node at work but even had the chance to really get into socket.io.

 

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, babadoctor said:

I have heard this argument many times, and google claims shutting down a hard drive/ turning it on is not a big hit on performance; although I don't ever shut it down...

 

https://superuser.com/questions/17228/is-turning-off-hard-disks-harmful

Sigh. The performance is not affected, the drive will be just as fast when it's turned on for the first time, or when you turn on the machine for the 5000th time, there will be no difference in performance.

 

You're reading it wrong. What I'm saying is that there is an increased risk of failure when the hard drive transitions from a well known state to another well known state : between the moment where it's in the state where it's turned off completely and at room temperature and the moment where the hard drive has reached the normal working temperature and the spindle runs at 5200-7200rpm and transfers are made.

There is much less risk of failure if you keep the hard drive running 24/7 compared to having the hard drive turned off for hours, then turn on and use it, then turn system off again.

 

Google has a study but they only tested how temperature affects operation during regular use : https://static.googleusercontent.com/media/research.google.com/en//archive/disk_failures.pdf

See 3.3 Utilization and 3.4 Temperatures - note Figure 3 from where you can sort of figure out that there's am Infantility / Premature Death rate ... they determined that with any new hard drive there's a much higher chance the hard drive will die in the first 3 months especially if you use it extensively (read and write data a lot, seek data on drive etc) .. so whoever wants to store lots of data may want to keep their system running 24/7 for a couple of months and copy data on drive, defragment drive, basically do some reads and writes on it, run it through the paces.

The see Figure 4 and Figure 5 where they show how the colder the hard drive runs at (maybe it's cooled to hard by fans) or the more outside some narrow temperature range is, the higher the risk of failure. If you go by their numbers, you'd want to keep the temperature between 30 and 40c.

 

As Google used these hard drives in servers processing queries and doing stuff for them, they didn't test the scenario where random servers turn off for hours then turn on, do some stuff for a few hours at some ambient temperature then are turned off again... all these hard drives are mostly hard drives running 24/7 with the exception of some reboots from time to time.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, mariushm said:

 

 

Well, I leave it on 24/7 anyways, so I should be okay

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

8 hours ago, vorticalbox said:

Maybe using socket.io to stream the file to the browser? 

I'll research more into nodeJS and maybe figure out a way to stream .ts files with this.

 

Thanks!

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

14 hours ago, babadoctor said:

I'll research more into nodeJS and maybe figure out a way to stream .ts files with this.

 

Thanks!

If you need any help with node send me a message, been doing it at work for 6 months now so getting ok at it lol

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×