ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
14.11k stars 826 forks source link

Unable to use ffmpeg.run on rtsp input stream #67

Open AbhinavA10 opened 4 years ago

AbhinavA10 commented 4 years ago

Describe the bug Unable to use ffmpeg.run to use rtsp stream as the input, and output the transcoded stream over an http stream using mpeg1video encoding. In ffmpeg, I can do the following

ffmpeg  -i rtsp://192.168.0.101/av0_1 -f mpegts -codec:v mpeg1video -b 800k -r 30 http://localhost:8081/password

However, when I try doing the same thing using ffmpeg.wasm, I get the following:

[info] load ffmpeg-core
[info] ffmpeg-core loaded
starting
[info] ffmpeg command: ./ffmpeg -nostdin -hide_banner -i rtsp://192.168.0.101/av0_1 -f mpegts -codec:v mpeg1video -b 800k -r 30 http://localhost:8081/password
[ffmpeg-stdout] Assertion failed: undefined
[ffmpeg-stderr] Assertion failed: undefined
[ffmpeg-stdout] RuntimeError: abort(Assertion failed: undefined). Build with -s ASSERTIONS=1 for more info.
[ffmpeg-stderr] RuntimeError: abort(Assertion failed: undefined). Build with -s ASSERTIONS=1 for more info.
// then prints out ffmpeg-core.js file

The code I used is below: example_stream.js:

const { createFFmpeg } = require('@ffmpeg/ffmpeg');
const ffmpeg = createFFmpeg({ log: true });
(async () => {
    await ffmpeg.load();
    console.log("starting");
    await ffmpeg.run("-i rtsp://192.168.0.101/av0_1 -f mpegts -codec:v mpeg1video -b 800k -r 30 http://localhost:8081/password");
  })();

To Reproduce Steps to reproduce the behavior:

  1. Create a new node project 2.npm install "@ffmpeg/ffmpeg"
  2. Run code above
  3. See error

Expected behavior Output similar to ffmpeg terminal command:

eng6@eng6-ThinkPad-P50s:~$ ffmpeg  -i rtsp://192.168.0.101/av0_1 -f mpegts -codec:v mpeg1video -b 800k -r 30 http://localhost:8081/password
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
...
Input #0, rtsp, from 'rtsp://192.168.0.101/av0_1':
  Metadata:
    title           : av0_1
  Duration: N/A, start: 0.034000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709), 1280x720, 29.97 tbr, 90k tbn, 180k tbc
Output #0, mpegts, to 'http://localhost:8081/password':
  Metadata:
    title           : av0_1
    encoder         : Lavf56.40.101
    Stream #0:0: Video: mpeg1video, yuv420p, 1280x720, q=2-31, 800 kb/s, 30 fps, 90k tbn, 30 tbc
    Metadata:
      encoder         : Lavc56.60.100 mpeg1video
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg1video (native))
Press [q] to stop, [?] for help

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

jeromewu commented 3 years ago

Right now rtsp/rtmp is not supported due to the external libraries is unable to integrate with ffmpeg.wasm, I am still looking for possibilities.

gigabyteservice commented 3 years ago

@jeromewu jeromewu Is it possible to Screen Capture API and MediaStream Recording API to record the screen and then use FFmpeg.wasm or ffmpeg.js to stream any RTMP server like youtube, Facebook at once?

hs-ye commented 3 years ago

Same request here, see https://github.com/ffmpegwasm/ffmpeg.wasm/issues/61

qinwei-gong commented 2 years ago

Hi, does ffmpeg.wasm support rtmp stream as input now? I am encountering a connection refused problem now: (async () => { await ffmpeg.load(); await ffmpeg.run( '-re', '-i', 'rtmp://x.xx.xx.xxx:1935/live/stream_id', ... ); })(); However, I got following error: [fferr] [tcp @ 0x1a67100] Starting connection attempt to x.xx.xx.xxx port 1935 [fferr] [tcp @ 0x1a67100] Connection attempt to x.xx.xx.xxx port 1935 failed: Connection refused [fferr] [tcp @ 0x1a67100] Connection to tcp://x.xx.xx.xxx:1935 failed: Connection refused [fferr] [rtmp @ 0x1a66c40] Cannot open connection tcp://x.xx.xx.xxx:1935 [fferr] rtmp://x.xx.xx.xxx:1935/live/stream_id: Connection refused [ffout] FFMPEG_END

I have no problem connecting to the rtmp stream using ffmpeg itself in command line though. Any help would be greatly appreciated!

qinwei-gong commented 2 years ago

Right now rtsp/rtmp is not supported due to the external libraries is unable to integrate with ffmpeg.wasm, I am still looking for possibilities.

@jeromewu is rtmp supported now?

Bec-k commented 1 year ago

Is rtsp working now or not implemented yet?

MrMirhan commented 1 year ago

somebody can give an answer please?