-
Notifications
You must be signed in to change notification settings - Fork 143
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
MJPEG multipart/x-mixed-replace image stream flashes/flickers #569
Comments
Thanks for pointing out the setting for the @jameshilliard Could you please indicate which options are you using when running |
I'm running mjpg-streamer with these options:
The bug happens with both the
I did check using the latest safari, chrome and firefox and none had this bug. |
So I did manage to fix the flicker for the javascript stream with this change. This doesn't seem to effect the multipart/x-mixed-replace flicker bug however.
My guess would be that this bug has something to do with the images from mjpeg-streamer coming in faster than wpewebkit is capable of rendering them which is causing the background to flash white. |
I came up with another hack to workaround the bug using HTML5 canvas with the import React, { Component } from "react";
import { FFCAM_SERVER_URL, IDCAM_SERVER_URL } from "../constants";
class FFCamera extends Component {
constructor(props){
super(props)
this.state = {
stream: FFCAM_SERVER_URL + '/?action=stream',
loaded: FFCAM_SERVER_URL + '/?action=stream'
}
}
componentDidMount() {
const canvas = this.refs.canvas
const ctx = canvas.getContext("2d")
const img = this.refs.image
const drawInterval = 30;
function draw() {
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
}
img.onload = () => {
draw();
setInterval(draw, drawInterval);
}
}
reloadStream = () => {
this.setState({loaded: ''})
setTimeout(() => {
this.setState({loaded: this.state.stream})
}, 0)
}
render() {
return (
<div>
<canvas ref="canvas" width={640} height={425} />
<img ref="image" onError={this.reloadStream} src={this.state.loaded} style={{visibility: 'hidden'}} />
</div>
);
}
}
export default FFCamera; |
I can confirm the flickering issue running WPE WebKit v2.24.3 with wpebackend-fdo 1.2.3 and libwpe 1.2.x. I can also confirm both workarounds that @jameshilliard posted do resolve the issue (though the I don't have a local MJPEG stream, but testing with this public cam showed the same behavior: Another cam at http://194.103.218.15/mjpg/video.mjpg which has just Will update to the latest stable WPE + libs next week and check if the issue persists. [Edited since I referenced the wrong WPE versions initially] |
I just tested with the latest WPE 2.26.x | libwpe 1.4.x | backend-fdo 1.4.x | cog 0.4.x and the flicker issue still occurs across all tested MJPEG streams. Appreciate any pointer where to start debugging @magomez / @zdobersek 😊 |
@tobias-grasse did you make any progress on this issue? I've ran into the same issue of wpe not being able to handle the amount of frames I'm sending from the rtmp stream. |
@urothis unfortunately not; but most streams are working flicker-free with the canvas workaround. It's significant overhead compared to just |
Unfortunately, this is still an issue with WPE 2.30.5 / cog 0.8.1 and libwpe/wpebackend-fdo 1.8.0. |
Easy workaround; Turning off Chrome's Settings => Advanced => System => "Use hardware acceleration when available" fixed this for me. ymmv |
I have tried to continuously reload image frame by frame with this code: <!DOCTYPE html>
<html>
<head>
<title>Frame by frame test</title>
<script>
function imgLoaded(image) {
setTimeout(() => {
image.src = "http://localhost:3000/camera-frame/0?ts=" + Date.now();
}, 40);
}
</script>
</head>
<body>
<img onload="imgLoaded(this)" src="http://localhost:3000/camera-frame/0" />
</body>
</html> This doesn't resolve the problem with flickering so it can be something with Snaps used:
|
When using wpewebkit 2.22.3 with the cog launcher with the following options the mjpg-streamer jpeg image stream flashes rapidly as new images are received:
I tried a number of options and for some reason using this prevents the flashing and shows the proper stream without flickering(there are grid overlay lines present when doing so however):
Any idea why setting
--draw-compositing-indicators=true
prevents the stream from flickering rapidly and how I might get it to stop flickering without the compositing indicator grid?The text was updated successfully, but these errors were encountered: