ffmpeg.wasm icon indicating copy to clipboard operation
ffmpeg.wasm copied to clipboard

Unable to use ffmpeg.run on rtsp input stream

Open AbhinavA10 opened this issue 5 years ago • 5 comments

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):

  • OS: Ubuntu 16.04
  • Browser Firefox
  • Version 75
  • Node version: 12.7.0
  • NPM version: 6.14.5
  • "@ffmpeg/ffmpeg" version: "^0.8.3",

Additional context Add any other context about the problem here.

AbhinavA10 avatar May 28 '20 14:05 AbhinavA10

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 avatar Nov 04 '20 00:11 jeromewu

@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?

gigabyteservice avatar Feb 11 '21 22:02 gigabyteservice

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

hs-ye avatar Apr 27 '21 02:04 hs-ye

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 avatar Sep 09 '22 18:09 qinwei-gong

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?

qinwei-gong avatar Sep 09 '22 23:09 qinwei-gong

Is rtsp working now or not implemented yet?

Bec-k avatar Mar 25 '23 14:03 Bec-k

somebody can give an answer please?

MrMirhan avatar Apr 12 '23 08:04 MrMirhan