jansmolders86 / mediacenterjs

A HTML/CSS/Javascript (NodeJS) based Media center
http://mediacenterjs.com
1.29k stars 243 forks source link

Stream of movie doesn't stop #157

Open CodingPeak opened 9 years ago

CodingPeak commented 9 years ago

When starting a movie, the stream starts. When returning to the movie overview (and stop watching the movie), the stream of frames doesn't stop, resulting in a quite busy server.

image

CodingPeak commented 9 years ago

After a while, an error occurs and the streaming stops as the server restarts.

image

jansmolders86 commented 9 years ago

This is an interesting one. From one point of view it would be good if the transcoding continues as long as the machine is idle. It will result in instantaneous playback seeing as the movie has already been transcoded. But that only applies when the server is idle. If you continue to use MCJS, it could cause slowdowns and errors.

CodingPeak commented 9 years ago

True, but when switching to another movie, two movies are being streamed.. I don't think that's good..

Jon889 commented 9 years ago

I think perhaps it should carry on transcoding for 5 or so minutes after you've stopped watching, just incase you resume it. And then optionally (as in the user can choose an option in settings) it will carry on after 5 minutes if it's idle. However the problem I have with transcoding is that if it's permanent it will use a lot of disk space as it's basically duplicating your movie library.

Jon889 commented 9 years ago

Also it seems there's a problem with progression markers, which is actually a bug, rather than unimplemented [yet].

jansmolders86 commented 9 years ago

@Jon889 I belive your latest changes to the transcoding methods may have fixed this issue, correct?

Jon889 commented 9 years ago

No, it only prevents starting a new transcoding if it's the same movie. If you switch to another movie then still both movies will be transcoding.

It would be good to be able to limit the resources that ffmpeg can use, currently on my machine it will transcode as fast as possible, using all the CPU power and making the fans on my laptop go to full speed, when really it only needs to be transcoding just ahead of the current playback time.

Also I have some movies that are already in mp4 format and don't need to be transcoded to be played back in the browser. So it would be good to detect this and just not transcode in this case at all.

jansmolders86 commented 9 years ago

I agree, I want to add the MP4 detection as well.

But as far as the trancoding goes, of course you can choose the level of quality but other than that I don't know how I would go about lessening the load on the CPU.

jansmolders86 commented 9 years ago

Hey @Jon889,

FYI: MP4 detection has been added! currently if the requested video is an MP4, it will be copied so that the browser can access it (streaming directly from harddisk isn't supported by browsers).