简体   繁体   English

从ffmpeg向ffserver发送2种不同的相机供稿

[英]Send 2 different camera feeds to ffserver from ffmpeg

I'm currently working in a project where I have to stream 2 webcams streams from a computer to another through a TCP connection, I can stream 1 without problem: 我目前在一个项目中,我必须通过TCP连接将2个网络摄像头流从一台计算机流传输到另一台计算机,我可以毫无问题地传输1个流:

using 运用

ffserver.conf: ffserver.conf:

            HTTPPort 8090
            HTTPBindAddress 0.0.0.0
            MaxClients 40
            MaxBandwidth 30000

            CustomLog -
            NoDaemon

            <Stream status.html>
            Format status
            ACL allow localhost
            ACL allow 192.168.0.0 192.168.255.255
            </Stream>

           #feed for camera 1
           <Feed webcam1.ffm>
           File /tmp/webcam1.ffm
           FileMaxSize 100M
           </Feed>

           #feed for camera 2
           <Feed webcam2.ffm>
           File /tmp/webcam2.ffm
           FileMaxSize 100M
           </Feed>

          #stream for feed 1
          <Stream webcam1.mjpeg>
          Feed webcam1.ffm
          Format mjpeg
          VideoSize 1280x720
          VideoFrameRate 30
          Preroll 0
          NoAudio
          Strict -1
          </Stream>

          #stream for feed2
          <Stream webcam2.mjpeg>
          Feed webcam2.ffm
          Format mjpeg
          VideoSize 1280x720
          VideoFrameRate 30
          Preroll 0
          NoAudio
          Strict -1
          </Stream>

command to run ffserver: 运行ffserver的命令:

          ffserver /etc/ffserver.conf

command to feed ffserver: 馈送ffserver的命令:

         ffmpeg -v 2 -r 20 -f video4linux2 -i /dev/video0 http://localhost:8090/webcam1.ffm

and it works perfect, but when I try to run the other feed: 并且效果很好,但是当我尝试运行其他提要时:

         ffmpeg -v 2 -r 20 -f video4linux2 -i /dev/video1 http://localhost:8090/webcam2.ffm

I can see just the second stream and the first one do not work anymore. 我只能看到第二个流,第一个流不再起作用。 some idea? 有想法吗?

Using multiple USB webcams simultaneously may saturate the bus. 同时使用多个USB网络摄像头可能会使总线饱和。 This seems to be your case since starting the second camera cuts the first one off. 这似乎是您的情况,因为启动第二台摄像机会切断第一台摄像机。

The situation has improved from when USB1.1 was common. 从USB1.1普及以来,情况已有所改善。 Most even low-end motherboards have multiple USB2/3 controllers, which are entirely independent and can run multiple cameras without concern. 甚至大多数低端母板都具有多个USB2 / 3控制器,它们完全独立并且可以运行多个摄像头而无需担心。 USB2 can support multiple cameras at low resolution and framerate. USB2可以以低分辨率和帧速率支持多个相机。 High framerate high resolution cameras sending uncompressed images may still saturate the bus 发送未压缩图像的高帧率高分辨率相机可能仍会使总线饱和

Source 资源

Possible solutions: 可能的解决方案:

  1. Switch to MJPEG input (lower bandwidth use) 切换到MJPEG输入(较低的带宽使用)

Check the capabilities of your device: 检查设备的功能:

ffmpeg -f v4l2 -list_formats all -i /dev/video0

If it supports MJPEG then use it instead of raw video: 如果它支持MJPEG,请使用它代替原始视频:

ffplay -f v4l2 -input_format mjpeg -i /dev/video0 ...

  1. Use a different USB controller for the second camera 对第二台相机使用其他USB控制器

If the motherboard doesn't feature multiple controllers then get a PCI USB card. 如果主板不具有多个控制器,则获取PCI USB卡。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM