TCL 脚本无法在 windows 7 平台上使用多个摄像头

TCL script unable to work with multiple camera on windows 7 platform

我的 TCL 脚本适用于单摄像头。 TCL脚本如下:

proc liveStreaming {} {

    #open the config file.
    set f [open "C:/main/video_config.txt" r] 

    #To retrive the values from the config file.
    while {![eof $f]} {
        set part [split [gets $f] "="]
        set props([string trimright [lindex $part 0]]) [string trimleft [lindex $part 1]]
    }
    close $f 

    #camera selection to live streaming.
    set camera "video"
    append cctv $camera "=" $props(cctv)

    #ffmpeg command to capture live streaming in background
    exec ffmpeg -f dshow -s 1280x720 -i $cctv c:/test/sample.avi >& c:/test/temp.txt &

}
liveStreaming

//above code is to capture video using ffmpeg and tcl.

我的文本文件"video_config"如下:

cctv=Logitech HD Webcam C525

因为,我希望它 运行 带有多个摄像头:文本文件应如下所示:

cctv=Integrated Webcam,Logitech HD Webcam C525

问题是“,”(逗号),我的 TCL 脚本无法预测逗号 (,)。任何人都可以为我提供可以预测昏迷的正确 TCL 脚本,以便我的 TCL 脚本可以与多个相机一起使用。

错误报告:

ffmpeg version N-89127-g8f4702a93f Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --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-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  3.103 / 58.  3.103
  libavformat    58.  2.100 / 58.  2.100
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  2.100 /  7.  2.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
[dshow @ 05944ac0] Could not find video device with name [Integrated Webcam,Logitech HD Webcam C525] among source devices of type video.
video=Integrated Webcam,Logitech HD Webcam C525: I/O error

您可以通过另一个 split 实现此目的,使用 foreach 循环:

proc liveStreaming {} {

    #open the config file.
    set f [open "C:/main/video_config.txt" r] 

    #To retrive the values from the config file.
    while {![eof $f]} {
        set part [split [gets $f] "="]
        set props([string trimright [lindex $part 0]]) [string trimleft [lindex $part 1]]
    }
    close $f 

    #camera selection to live streaming.

    # let cams be the list of available cameras
    set cams [split $props(cctv) "," ]
    set idx 0

    # for each camera in cameras list    
    foreach cam cams {
        set cctv "video=$cam"

        #ffmpeg command to capture live streaming in background
        exec ffmpeg -f dshow -s 1280x720 -i $cctv "c:/test/sample-$idx.avi" >& "c:/test/temp-$idx.txt" &    

        # create a new index (to prevent two cameras to create the same file)
        incr idx
    }
}
liveStreaming