【问题标题】:ffmpeg stream videos from two cams have a same device name来自两个摄像头的 ffmpeg 流视频具有相同的设备名称
【发布时间】:2020-02-19 09:15:29
【问题描述】:

有两个摄像头具有相同的设备名称Microsoft® LifeCam Studio(TM)
ffmpeg -list_deivces true -f dshow -i dummy 打印以下输出。

C:\Users\user>ffmpeg -list_devices true -f dshow -i dummy
ffmpeg version git-2020-02-05-e6891d1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 39.100 / 56. 39.100
  libavcodec     58. 67.101 / 58. 67.101
  libavformat    58. 37.100 / 58. 37.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 74.100 /  7. 74.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[dshow @ 000001d5c5108dc0] DirectShow video devices (some may be both video and audio devices)
[dshow @ 000001d5c5108dc0]  "Microsoft® LifeCam Studio(TM)"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_pnp_\\?\usb#vid_045e&pid_0811&mi_00#8&6ae46e6&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001d5c5108dc0]  "Microsoft® LifeCam Studio(TM)"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_pnp_\\?\usb#vid_045e&pid_0811&mi_00#8&e544916&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001d5c5108dc0] DirectShow audio devices
[dshow @ 000001d5c5108dc0]  "Desktop Microphone (6- Microsoft® LifeCam Studio(TM))"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{D5F4881A-6E88-4563-8BA0-081CFD50E353}"
[dshow @ 000001d5c5108dc0]  "Desktop Microphone (5- Microsoft® LifeCam Studio(TM))"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{84674B28-DC68-4AC0-8331-D687C7B7D69C}"
[dshow @ 000001d5c5108dc0]  "Digital Audio (S/PDIF) (High Definition Audio Device)"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{CDD24485-59D2-4BED-B6FC-B7447251C7E2}"

由于两个摄像头具有相同的设备名称,我无法同时使用以下简单命令流式传输两个视频:ffplay -f dshow -i video=Microsoft® LifeCam Studio(TM)
所以我在ffmpeg dshow example 之后使用了引脚名称。 我唯一能查到的是Could not find video device with name [video=~~pin name~~] among source devices of type video.

什么ffplay 命令可以启用流式传输两个视频?

【问题讨论】:

  • @aergistal 我检查了使用 video_device_number 的方式,每个摄像机的参数为 0 和 1。 ffplay for video device number 0 播放视频流,但它打印“Could not run graph (sometimes of a device already in use by other application)”错误与设备号 1

标签: ffmpeg directshow


【解决方案1】:

我在使用这些廉价的 HDMI 捕获 USB 加密狗时遇到了同样的情况。仔细阅读答案在页面上:http://ffmpeg.org/ffmpeg-devices.html#dshow

同名 dshow 设备由 ffmepg 索引。在 Windows 中,您在“-f dshow”和“-i”设备名称之间添加“-video_device_number xxx”。其他平台的开关名称不同,但语法非常相似。

ffmpeg -f dshow -video_device_number 0 -i video="USB Video" ....

【讨论】:

    【解决方案2】:

    试试

    ffmpeg \
        -rtbufsize 10MB -f dshow -i video="@device_pnp_\\?\usb#vid_045e&pid_0811&mi_00#8&6ae46e6&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" \
        -rtbufsize 10MB -f dshow -i video="@device_pnp_\\?\usb#vid_045e&pid_0811&mi_00#8&e544916&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" \
        -filter_complex hstack,format=yuv420p -f sdl -
    

    如果出现错误,请更换另一个 USB 端口。

    https://ffmpeg.org/ffmpeg-filters.html#hstack

    【讨论】:

      猜你喜欢
      • 2011-10-07
      • 2022-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-03
      • 2019-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多