-
-
Notifications
You must be signed in to change notification settings - Fork 785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transcode stream refactor #609
Transcode stream refactor #609
Conversation
Incidentally, this should eliminate the performance impact of not having the scene containers in the database. |
Mp4 as a container is not suited for live streaming. |
Yeah i would imagine everyone at some point would have finished a new scan to update the containers but the #522 will be changed back to draft till we sort this out. |
MP4 appears to work correctly on Chrome, but not on Firefox. I'm not sure if it's worth spending the time and effort fixing it when Firefox supports webm anyway. The latest commit adds support for HLS for Safari. Initial testing looks good, but I need to do a more extension test run. HLS is supported in Edge but playback didn't work for me, so I've made it so that it won't use HLS unless other options aren't available. The HLS support was assisted with knowledge from a fork of Golang HLS Streamer. The fork was a lot more basic than the original, so there's possibly some improvements to be done with further study of that project. For example, this file looks like it might have some refinements that might improve it. |
Some quick feedback from testing on an Android Smartphone. Microsoft Edge ( got the hint from discord ) is the only browser that i found which supports hevc natively. This can be direct streamed (no transcode) when Force Hevc was checked in the dev build. In this version HEVC is not detected as supported. Chrome and Edge ( again in android ) show |
@bnkai Android does support HLS, see https://support.jwplayer.com/articles/adaptive-streaming-reference#hls-support However according to jwplayer it only supports an older spec, so some tweaks might be required. I can see if I can get it working. EDIT: Couldn't get anywhere with HLS in Android. Probably not worth messing with for now. |
@InfiniteTF i found this https://alexzambelli.com/blog/2016/05/04/understanding-hls-versions-and-client-compatibility/ regarding hls specs. I think for the job we need it even the oldest version is enough. |
What is the consequence of leaving the HLS compatibility code as is if Android Chrome only uses it if forced? I'd rather not add Safari-detection code if we can avoid it, since it's apparently very difficult to do and is brittle. I'm thinking we should consider a move away from jwplayer if we can maintain the same features. |
With the code as it is it doesn't really matter since you have to alter the code yourself to reach hls in other browsers. The safari detection was mainly for cosmetic reasons and if it was easy to implement. |
I've done a major refactor of this PR. The
The first endpoint is a direct stream of the source file. The mkv endpoint is a video copy stream and the remaining transcode to the applicable type. I have replaced On the client end, I have changed it so that jwplayer receives a list of source urls, allowing it to choose the correct compatible stream. In addition, if the stream fails due to an incompatible stream, then it will fail over to the next source. I am hoping that this will make the |
From Discord, hearing that hevc/aac MKV files are not streaming correctly on iPad safari. On Chrome these files also appear to only be outputting audio only. Files were encoded using: https://github.com/FallingSnow/h265ize |
The same thing happens to me in chrome/linux. EDIT hevc/aac mp4 files have the same issue. Audio is supported and played thus jwplayer doesn't show an error , even if the video codec is not supported and played through EDIT2 from a quick look i think this behaviour can be explained if the below code is somehow not executed/behaving correctly this.player.on("error", (err: any) => {
if (err && err.code === 224003) {
if (this.tryNextStream()) {
this.player.load(this.playlist);
this.player.play(); With the latest refactor how is container/codec compatibilty checked exactly? WMV and AVI files seem to transcode fine so if the above code works for them it should also work at least for the firefox/hevc/aac/mkv case |
The failover code was broken which is why you saw the 224003 error. For the no video issue, I've added some code that detects if the video metadata width and height are zero, and if so fails over to the next source. |
The error retrieval seems to work now but VP8 is used instead of VP9 so it should be changed to VP9. |
Corrected the webm codec and fixed the thumbnail sprite regression. I've removed |
Everything looks ok except the minor issue with microsoft edge and hevc in android mentioned above. |
Tested the current |
The hevc in android support should be a combination of browser/android version/hardware. |
I think I might have to chalk this up as a limitation at the moment: The issue was introduced by the no video detection added in 3b816fe. If this code is removed, then it streams directly in Android Edge. The no video detection works by hooking into the One alternative would be to detect Android Edge and disable the no video detection when on that client, but I just don't think it's worth the hassle. |
I think we can leave that as a limitation especially if #679 can be used instead in android. |
* Remove forceMkv and forceHEVC * Add HLS support and refactor * Add new streaming endpoints
This is a significant refactor of the transcode streaming code.
The
forceMKV
andforceHEVC
flags have been removed, andis_streamable
has been removed from the scene graphql type. Instead, there is a newIsSceneStreamable
graphql query that accepts a list of supported video codecs. Similarly, thestream.mp4
route has been changed to accept a list of codecs as well. The supported video codecs are obtained using a custom Modernizr build that only tests for video support. There is an additional test for mkv support, but it is hard-coded to check if the client browser is Chromium-based.On the backend, the transcode code is changed so that it chooses the codec to use based on the supported codecs sent to the request. It is currently hard-coded to prefer VP9, VP8, HEVC then H264. This should probably be further refined to accept the supported codecs in order of preference.
This doesn't fix the Safari bug referenced in #600 but is a decent first step.This obsoletes a lot of the changes in #522 which will need to be reworked if we go ahead with this.Fixes #600