Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkv file error: Error adding External Input:-2 #1827

Open
fengmao31 opened this issue Jul 26, 2022 · 1 comment
Open

mkv file error: Error adding External Input:-2 #1827

fengmao31 opened this issue Jul 26, 2022 · 1 comment

Comments

@fengmao31
Copy link

fengmao31 commented Jul 26, 2022

Ubuntu20

Problem

when I push the vp8 mkv file, it show the error
(Room) message: Error subscribing to stream

Code

const serverUrl = '/';
let localStream;
let room;

window.onload = function () {

  const config = { audio: true, video: true, data: true, videoSize: [640, 480, 640, 480] };
  const config2 = { video: true, audio: false, url: "rtsp://172.28.5.201:8554/live/test" };
  const config3 = { video: true, audio: false, url: "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4" };
  const config4  = {video: true, audio: false, url: "file:///home/fengmao/output.mkv" };
var localStream = Erizo.Stream(config4);

const createToken = (userName, role, callback) => {
    const req = new XMLHttpRequest();
    const url = `${serverUrl}createToken/`;
    const body = { username: userName, role };

    req.onreadystatechange = () => {
      if (req.readyState === 4) {
        callback(req.responseText);
      }
    };

    req.open('POST', url, true);
    req.setRequestHeader('Content-Type', 'application/json');
    req.send(JSON.stringify(body));
  };

  createToken('user', 'presenter', (response) => {
    const token = response;
    console.log(token);
    room = Erizo.Room({ token });

localStream.addEventListener("access-accepted", function () {

    var subscribeToStreams = function (streams) {
        for (var index in streams) {
          var stream = streams[index];
          if (localStream.getID() !== stream.getID()) {
              room.subscribe(stream);
          }
        }
    };

    room.addEventListener("room-connected", function (roomEvent) {

        room.publish(localStream);
        subscribeToStreams(roomEvent.streams);
    });

    room.addEventListener("stream-subscribed", function(streamEvent) {
        var stream = streamEvent.stream;
        var div = document.createElement('div');
        div.setAttribute("style", "width: 320px; height: 240px;");
        div.setAttribute("id", "test" + stream.getID());

        document.body.appendChild(div);
        stream.play("test" + stream.getID());
    });

    room.addEventListener("stream-added", function (streamEvent) {
        var streams = [];
        streams.push(streamEvent.stream);
        subscribeToStreams(streams);
    });

    room.addEventListener("stream-removed", function (streamEvent) {
        // Remove stream from DOM
        var stream = streamEvent.stream;
        if (stream.elementID !== undefined) {
            var element = document.getElementById(stream.elementID);
            document.body.removeChild(element);
        }
    });

    room.connect();
    localStream.play("myVideo");
});
localStream.init();});
};

Console

eyJ0b2tlbklkIjoiNjJkZjZhYTM5ZTFlMzQwMzBmMjAwMTgxIiwiaG9zdCI6IjE3Mi4yOC44LjIyOjgwODAiLCJzZWN1cmUiOnRydWUsInNpZ25hdHVyZSI6Ik9XSTRaakZoTkRNM01EUmhaV1UwWldaa1pUQTFZMlU0WldOaFpqQTBOMlZqWkdReU9EZ3haQT09In0=
erizo.js:100 INFO:  (Room) message: Connecting to room, tokenId: 62df6aa39e1e34030f200181
erizo.js:100 INFO:  (Socket) message: connect, previousState: Symbol(disconnected), id: undefined
erizo.js:100 INFO:  (Socket) message: connected, previousState: Symbol(disconnected), id: undefined
erizo.js:100 INFO:  (Room) message: Connected to room, roomId: 62dbd35b1ff6bf0304a3d79c
erizo.js:100 INFO:  (Room) message: Publishing stream, streamId: local, label: ei_4785, roomId: 62dbd35b1ff6bf0304a3d79c
erizo.js:100 DEBUG:  (Room) message: Checking publish options, streamId: local, label: ei_4785, roomId: 62dbd35b1ff6bf0304a3d79c
erizo.js:100 ERROR:  (Room) message: Error when publishing the stream, streamId: local, label: ei_4785, roomId: 62dbd35b1ff6bf0304a3d79c, error: Error adding External Input:-2

Terminal

[erizo-516952bb-3344-e678-a6e6-1193416cd74d] 2022-07-26 09:59:36.052  - INFO: ErizoJSController - Start checking uptime, interval 1800
[erizo-516952bb-3344-e678-a6e6-1193416cd74d] 2022-07-26 09:59:36.052  - INFO: Client - Constructor Client file:///opt/licode/video/2.mkv, singlePC: false, strategy: false  
2022-07-26 09:59:36.053  - INFO: Client - Trying to set undefined strategy Id false, reverting to default algorithm
[erizo-516952bb-3344-e678-a6e6-1193416cd74d] 2022-07-26 09:59:36.053  - WARN: Publisher - message: Adding ExternalInput, id: 621007416545054700_file:///opt/licode/video/2.mkv, url: file:///opt/licode/video/2.mkv
[erizo-516952bb-3344-e678-a6e6-1193416cd74d] [matroska,webm @ 0x4a01760] Unknown entry 0x55B0
[erizo-516952bb-3344-e678-a6e6-1193416cd74d] 2022-07-26 09:59:36.057  - INFO: Client - message: Adding connection to Client, clientId: file:///opt/licode/video/2.mkv, connectionId: undefined,  
[erizo-516952bb-3344-e678-a6e6-1193416cd74d] 2022-07-26 10:00:56.752  - INFO: ErizoJSController - message: requested removeClient, clientId: aebddacb-8ca4-4267-85e5-21ad444609ff
[erizo-516952bb-3344-e678-a6e6-1193416cd74d] 2022-07-26 10:00:56.752  - INFO: ErizoJSController - message: removeClient - client is not present in this ErizoJS, clientId: aebddacb-8ca4-4267-85e5-21ad444609ff
@Arri98
Copy link
Contributor

Arri98 commented Jul 26, 2022

The mkv container is not being able to open the file. If you have ffmpeg installed try to encode the video with the following command ffmpeg -i INPUTFILE -c:a libopus -g 50 -c:v vp8 -b:a 48k out.mkv

Like I commented in the rtsp issue, publish the stream with one client and subscribe to it from another client as the publisher can not subscribe to its own stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants