My TCL script works properly for single camera. the TCL script is as follow :
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.
My text file "video_config" is as follow:
cctv=Logitech HD Webcam C525
as, i want it to run with multiple camera : the text file should be as follow :
cctv=Integrated Webcam,Logitech HD Webcam C525
The problem is "," (comma), my TCL script is unable to predict the coma (,) . can any one provide me the proper TCL script which can predict the coma, so that my TCL script can work with multiple camera.
Error Report :
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
You can achieved this with another split
, using a foreach
loop:
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