JSMpeg – MPEG1 Video & MP2 Audio Decoder in JavaScript for ios stream
First try this demo can play on ios
Second
https://github.com/phoboslab/jsmpeg#encoding-videoaudio-for-jsmpeg
view-stream.html (nodejs localhost:8080 maybe can see)
websocket-relay.js this is use node.js then get ws server
Import !!
ffmpeg -re -i rtmp://xxx.xxx.xxx.xxx/live/ooo -f mpegts -codec:v mpeg1video -bf 0 -codec:a mp2 -s 640x360 -r 30 -q 4 -muxdelay 0.001 http://localhost:8081/password
-re 參數表示以視頻實際播放速率解碼,不加這個參數一般會導致直播速率變得飛快
-re一定要加,代表按照帧率发送,否则ffmpeg会一股脑地按最高的效率发送数据。
-muxdelay 0.001 reduce lag (maybe no use)
-q 4 Need test
You’re setting -q 1, which is the best possible quality. Try setting it to 4 or 8 instead.
compression_level (-q)
Set algorithm quality. Valid arguments are integers in the 0-9 range, with 0 meaning highest quality but slowest, and 9 meaning fastest while producing the worst quality. Can put more than 9.
mpegts this is see error, then find some guy say use mpegts.
Don’t use mpeg1video
https://github.com/phoboslab/jsmpeg/issues/149
localhost:8081/password this is “node websocket-relay.js” screen have notify, just try
Example: node websocket-relay.js password 8081 8080
https://github.com/phoboslab/jsmpeg#example-setup-for-streaming-raspberry-pi-live-webcam