-
Notifications
You must be signed in to change notification settings - Fork 60
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
native video decoding errors #114
Comments
I believe we push the frames to the MSE at the wrong time. We listen for waiting, but it seems to be a better practice to push again when updateend is firing. |
@totaam Check out https://github.com/TijZwa/xpra-html5/tree/%23114 |
Did some work on the code. It works, but there are a few pitfalls. |
Right. OTOH, there are things we could do to mitigate this - but none are going to be perfect.
This isn't a problem for broadway software decoding because that one is completely synchronous: we submit a frame and get the rgb data back. |
@totaam The second option (send the whole window as one video stream) could be great for testing. Is there an Xpra switch I can use to achieve this? |
Yes: |
Sending full frames works but makes text fuzzy (as expected). Other options might be a better choice. |
Yes. And this limits our options: bumping up the quality (some codecs have a lossless mode enabled with |
It seems that our best bet might be the MediaStreamTrackProcessor (https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackProcessor)
Got the first 6 steps working, will commit the code after the last three steps. |
Wow. Awesome! |
While working on the MSE solution I found something even more awesome. Chrome 94+ supports the new VideoDecoder in secure contexts (HTTPS). I've tested this and it works great!! This seems to be a drop-in replacement for broadway and we dont need to mux the video. Refers:
To do:
|
I would guess not. The muxed video is just too hard to get right. |
Some more information about the subject: Draft: https://www.w3.org/TR/webcodecs/ It seems to be a good idea to use the OffscreenCanvas API inside a web-worker and feed it the VideoFrame. |
Implemented some more code:
This works great, but sometimes I see server logs like this: |
This one (
No.
They can arrive in any order.
You already have gaps, so 1490 to 1495 and 1498 to 1500 have been acked. |
Perhaps I was wrong about this. |
We did some internal testing and the speed of the native Video- and AudioDecoders is very good. Combined with offscreen painting ther performance is excellent. |
Should we close this ticket in favour of #122 and the offscreen video decoder? |
Yes, let's do that. |
Sometime since e0e5de3 (2016!)
I have added an example to enable
fastdecode
: ca3d1dbAnd the xpra server will now honour it, both with
h264+mp4
andmpeg4+mp4
:Xpra-org/xpra@b10da3f
Note: to change which actual codec the server will choose for the html5 client in "native" video mode, using the "score-delta" for the codec chosen: 8cf87c2 (
h264+mp4
is now ahead ofmpeg4+mp4
).This command generates an h264 stream that browsers can play:
Link: Fragmented MP4 - problem playing in browser
Comparing it with our
enc_ffmpeg
encoder:YUV420P
(orNV12
withlibva
- which translates to the same subsampling)baseline
profile since 8cf87c2fastdecode
since b10da3f3291d492839843e12a08359c40cd40f8aultrafast
presetempty_moov+frag_keyframe+default_base_moof+faststart
- IIRC, faststart is important tooThere are a lot more
fastdecode
tweaks in the plainenc_x264
encoder:https://github.com/Xpra-org/xpra/blob/b10da3f3291d492839843e12a08359c40cd40f8a/xpra/codecs/enc_x264/encoder.pyx#L594-L597
https://github.com/Xpra-org/xpra/blob/b10da3f3291d492839843e12a08359c40cd40f8a/xpra/codecs/enc_x264/encoder.pyx#L634-L638
removed B frames, sliced threads, b_weighted_bipred, i_weighted_pred.
Perhaps these tweaks would help with the
enc_ffmpeg
encoder?Here is the cryptic browser error:
The text was updated successfully, but these errors were encountered: