Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#428·jsmpeg

Is decoding performed on the client(jsmpeg.min.js) or the server(node-rtsp-web)?

Author: Goohyun3436Created Mar 26, 2024Updated Mar 26, 2024

I tried streaming multichannel using server(node-rtsp-web) and client(jsmpeg.min.js).

When I register more than 4 channels, the frame breaks.

Is "jsmpeg.min.js" simply the role of converting base64 values to suit canvas or does it perform decoding?

Or is it transmitting the decoding value from ffmpeg on server(node-rtsp-web) to the client(jsmpeg.min.js) using webSocket?



index.html

xml
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>node-rtsp-web</title>
</head>
<body>
    <canvas id="canvas"></canvas>
    <script type="text/javascript" src="/jsmpeg.min.js"></script>
    <script type="text/javascript">
        player = new JSMpeg.Player(`ws://SERVER_URL:STREAM_PORT`, {
            canvas: document.getElementById('canvas')
        })
    </script>
</body>

</html>

server.js

javascript
Stream = require('node-rtsp-stream')

stream = new Stream({
    name: `STREAM`,
    streamUrl: RTSP_URL,
    wsPort: WS_PORT,
    ffmpegOptions: {
        '-s': '640x360',
        '-b:v': '1000k',
        '-r': 20
    }
})

Source: phoboslab/jsmpeg

View original on GitHubView discussion on GitHub