【问题标题】:streaming laptop webcam to wowza server with juv rtmp client使用 juv rtmp 客户端将笔记本电脑网络摄像头流式传输到 wowza 服务器
【发布时间】:2017-08-17 05:03:57
【问题描述】:

我最近正在做一个将视频发布到 wowza 服务器的项目。我可以使用 JUV rtmp 客户端 api 从文件中发布视频。但我需要直接从我的笔记本电脑网络摄像头发布视频。我怎么能那样做?请举例说明或演示。

我的流视频文件代码的主要部分在这里:

final NetConnection connection = new NetConnection();

    connection.configuration().put(NetConnection.Configuration.INACTIVITY_TIMEOUT, -1);
    connection.configuration().put(NetConnection.Configuration.IO_TIMEOUT, 20 /*milliseconds*/);

    connection.addEventListener(new NetConnectionListener());

    connection.connect("rtmp://localhost:1935/live");

    try
    { 
        Thread.sleep(2000);
    }
    catch (Exception e) {/*ignore*/}
    // wait till connected

    System.out.println("then connection: "+connection.connected());
    final MediaStreamController controller = new MediaStreamController();

    final String streamFile = "C://media/JUV.FLV";

    controller.addListener(new IMediaStreamController.ListenerAdapter()
    {
        @Override
        public void onStart(final long timestamp, final IMediaStream stream)
        {
            System.out.println("onStart: " + timestamp + " " + stream);
        }

        @Override
        public void onStop(final long timestamp, final IMediaStream stream)
        {
            System.out.println("onStop: " + timestamp + " " + stream);

            if (stream != null)
            {
                stream.release();
            }

            try
            {
                controller.play(new FlvFileMediaStream(streamFile), -1 /*play the whole file*/);
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }

        @Override
        public void onRelease(final long timestamp)
        {
            System.out.println("onRelease: " + timestamp);
        }
    });

    if (!disconnected)
    {
        NetStream stream = new NetStream(connection);

        stream.addEventListener(new NetStream.ListenerAdapter()
        {
            @Override
            public void onNetStatus(final INetStream source, final Map<String, Object> info)
            {
                System.out.println("NetStream#onNetStatus: " + info);

                final Object code = info.get("code");

                if (NetStream.PUBLISH_START.equals(code))
                {
                    try
                    {   System.out.println("playing: ");
                        controller.play(new FlvFileMediaStream(streamFile), -1 /*play the whole file*/);
                    }
                    catch (Exception e)
                    {
                        e.printStackTrace();
                    }
                }
            }
        });

        stream.attachAudio(new MediaStreamMicrophone(controller));
        stream.attachCamera(new MediaStreamCamera(controller), -1);

        stream.publish("stream", NetStream.LIVE);
    }

    while (!disconnected)
    {
        try
        {
            Thread.sleep(100);
        }
        catch (Exception e) {/*ignore*/}
    }

    connection.close();
}

【问题讨论】:

    标签: java webcam rtmp wowza


    【解决方案1】:

    要将您的笔记本电脑网络摄像头流式传输到 Wowza 服务器,您需要在笔记本电脑上安装一个软件应用程序,该应用程序可以对流进行编码并将其发送到 Wowza 服务器。有许多潜在的解决方案,从开源的 ffmpeg 项目到 Adob​​e 的 Flash Media Live Encoder

    【讨论】:

    • .@orde,实际上我之前应该提到我需要以编程方式进行。Java 程序将完成所有事情。我已经发布了存储在磁盘上的 flv 视频文件。但我需要捕获网络摄像头并将捕获的视频发送到 wowza server.can you help me plz???
    猜你喜欢
    • 2018-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-08
    • 2015-09-10
    • 1970-01-01
    相关资源
    最近更新 更多