phoboslab / jsmpeg

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

new jsmpeg.js hanging #159

Open jana4cheyenne opened 7 years ago

jana4cheyenne commented 7 years ago

hi,

i played previous and new version of jsmpeg.js in the same page. the previous version work perfectly, but the new version show a black canvas at the beginning (more than 15 sec), and it start to play not smoothly. video of new version keep on hanging and update canvas several sec.

below is my setting for both streaming, could you please advise me what should i do? thanks.

linux server running two ffmpeg processes:

for previous version jsmpeg:

ffmpeg -i rtmp://127.0.0.1/live/stream -filter_complex "eq=contrast=1,unsharp=9:9:1" -f mpeg1video -b:v 350k -r 20 -s 320x180 http://127.0.0.1:443/old

for new version jsmpeg:

ffmpeg -i rtmp://127.0.0.1/live/stream -filter_complex "eq=contrast=1,unsharp=9:9:1" -f mpegts -codec:v mpeg1video -b:v 350k -r 20 -s 320x180 http://127.0.0.1:443/new

playing both streaming in the same html:

var ws_old = new WebSocket('ws://192.168.10.10:8080/old'); var cv_old = document.getElementById('cv_old'); var js_old = new jsmpeg(ws_old, {canvas:cv_old});

var cv_new = document.getElementById('cv_new'); var js_new = new JSMpeg.Player('ws://192.168.10.10:8080/new', {canvas:cv_new});

phoboslab commented 7 years ago

Are you using the same NodeJS server for both? You need to use the updated websocket-relay.js with the current JSMpeg version. The old server version added a custom header for each packet that the new client wont understand.

If not, maybe there's some buffering in ffmpeg before it emits a new mpegts packet. I've had some success with -muxdelay 0.0001.

jana4cheyenne commented 7 years ago

many thanks. i will try it and report there.

calvinwyoung commented 5 years ago

@jana4cheyenne I know this is an old thread, but did you ever resolve this issue? I'm running into a similar problem, and setting a muxdelay doesn't appear to help.