phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.37k stars 1.43k forks source link

Certain mpeg artifacts #12

Closed skerit closed 10 years ago

skerit commented 10 years ago

The library works great. The lack of latency is insane.

I do get certain artifacts when rendering the mpeg stream, like this:

bars

Any idea on how I can get rid of those? My avconv/ffmpeg options are very simple:

avconv -f x11grab -r 25 -s 1280x720 -i :0.0 -f mpeg1video -b 3000k pipe:1

And yes, it happens at any resolution, at any bitrate. And also when transcoding other video files, not just x11grab.

Btw: this might just be a proof-of-concept piece of code, but when latency really matters I don't see an alternative.

I've tried setting up MediaSource yesterday, and got it to work eventually. But, as your blog post said, it only starts playing 3-5 seconds after receiving the first frame.

phoboslab commented 10 years ago

What artifacts? Missing frames? Stuttering? Missing blocks? Shifted blocks? Screenshot? :)

I don't know much about avconv. Maybe it's encoding B-Frames, which are not handle by jsmpeg? avconv probably has a flag to omit those.

I know you said it happens at any resolution, but anyway: 1280x720 is A LOT of pixels for a JavaScript video decoder.

skerit commented 10 years ago

Missing blocks, yeah. There is a screenshot in my original post, it has a few green bars in it.

However: I also tested it out by rendering to an mpeg file and testing it in a regular video player and it contains the same problem, so it really is some avconv issue.

And by the way: the 720p resolution is indeed pushing the limit of the decoder, but it works surprisingly well!

phoboslab commented 10 years ago

Oh, damn. I thought the screenshot was meant to show your code. I didn't realize it's a screenshot from the actual mpeg stream, sorry :)

Closing this, since it's an issue with avconv. I guess the mpeg1 encoder in avconv hasn't been thoroughly tested in a long while!?