ffmpegwasm/ffmpeg.wasm

Unable to use ffmpeg.run on rtsp input stream

Open

#67 opened on May 28, 2020

View on GitHub
 (7 comments) (1 reaction) (0 assignees)C (17,474 stars) (1,071 forks)batch import
help wanted

Description

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.

Contributor guide