How to detect the camera disconnection in linux? - linux

How will you detect the camera signal disconnection (not the module disconnection or hardware disconnection) without the support of V4l2-ctl command? Because my Camera Driver is not supporting v4l2-ctl command.

Found the temporary solution for camera disconnection in linux.First let me explain how to find the camera disconnection(signal disconnection) from your linux with the support of v4l2-ctl command
Command is :-
$v4l2-ctl -d <device name>(for ex-/dev/video0) --all
will list all the parameters of the camera where in the video input you can find the camera signal value changes when you disconnect the camera signal.
For without the support of v4l2 it takes 2 seconds with the help of ffmpeg command to find out.
With ffmpeg command we can take pictures of the camera devices every second and through shell script we can find out the space of the image taken for the latest file.If the image is less than 1KB then we can say that the camera signal is disconnected

Related

Building a software parrot repeater with Linux CLI audio-processing tools?

I have an audio coming from a radio transceiver on my sound card's microphone input. What i want to make is a simple software-based parrot repeater using Linux CLI tools like the sox suite and arecord. For it to work, i think a flow similar to the following must take place:
The audio that comes on the microphone subdevice is getting recorded in a buffer (file or RAM-based)
When the buffer stops filling (audio stopped), start playing it's content on the audio output device (it is connected to the radio's microphone input)
When it's over, empty the buffer and start expecting step 1 to occur again
I'm looking for an elegant way to implement the logic behind step 2. Is there a CLI tool that i can use for that, so i can pipe the microphone audio taken with arecord to it and play the output of the buffer with sox?
Try looking at this. I did this on a raspberry pi a little while ago, only I made a voice changer.
https://www.instructables.com/Halloween-Voice-Changer-With-Raspberry-Pi/
Basically, play "|rec --buffer 2048 -d" takes recorded sound and puts it in a buffer that is passed in 4096 bit (byte?) chunks to play. -d stands for duration, and if left blank defaults to 0, and will run until killed. If you want to play with the options, there is some helpful info in the links.
Good luck with your project!

Multi camera detection issue (not detected)

I am trying to set a multi camera in my computer on Linux 14.04.
In fact, the name of the camera is LadyBug5.
https://www.ptgrey.com/ladybug5-360-degree-usb3-spherical-camera-systems
after the different configuration of drivers, I got this message in terminal, saying that I cannot detect the camera as desired :
zac#zac:~/catkin_ws/src/ladybugcapture$ LadybugRecorderConsole
Loading configuration from /etc/ladybug/LadybugRecorderConsole.xml
*** Configuration ***
Camera Configuration
Data format: JPEG (8-bit)
Frame rate: 10
Use auto frame rate: Yes
JPEG quality: 80%
GPS Configuration
Use GPS: No
Port: 4
Device name: dev/ttyACM0
Baud rate: 115200
Refresh interval (ms): 1000
Stream Configuration
Destination directory: .
Cameras detected: 0
Insufficient number of cameras detected.
Error: Failed to initialize camera (Operation failed)
Do you have any tips to resolve this problem?
thanking you in advance
My first question is: is the camera recognized by the linux kernel? Detach the camera from the computer, run dmesg command, then atach the camera to your computer and run dmesg agin. The new lines at the end of the output should give a first hint if the camera is recognized at all.
After this try the lsusb command to see if the USB subsystem has access to the camera.
If it looks fine, then you could have a problem with the access rights to the camera's USB system. Can you try to run the LadybugRecorderConsole command with root privileges, e.g. sudo LadybugRecorderConsole?

Is it possible to capture audio from an ASIO device with ffmpeg?

We have a setup with a Windows 7 machine where we installed Dante Virtual Soundcard and start that soundcard with ASIO capabilities. The soundcard will receive audio over the network from a Tesira server. We want to capture the audio to files (highly preferring each channel to a separate file). The files will be played back on a later moment. There will likely be 6 channels or more.
In the same setup we use ffmpeg to capture some video which is working fine, with Direct Show. So for audio we wanted to use the same setup, since ffmpeg is able to record audio as well. However, there seems to be no option to select the ASIO devices which the virtual soundcard probably creates. So the question is what command line to use for ffmpeg, or what to install? Or which other program can record ASIO from command line?
I already tried installing:
Asio4all (actually wrong way around)
sox (don't know why actually)
HiFi Cable Asio Bridge (from VB-audio, not enough channels even with donate version)
Voicemeeter (from VB-Audio, not enough channels and actually mixes down)
O Deus Asio link, this might be an interesting option but it did not let me configure any route, any suggestions?
One thing I noticed is that the virtual soundcard can also be set to use WDM. Then I can see the devices with ffmpeg -list_devices true -f dshow -i duymmy, but recording does not yield any result, I have to ctrl-c to make it stop instead of q, and the file is zero bytes. Supposedly this is because the data over the network is all ASIO formatted and the Tesira Server cannot send "WDM data". FFmpeg stops at selecting the capture pin for audio only
EDIT:
I ran ffmpeg with high verbosity and when selecting the WDM soundcard it stops at Selecting pin Capture on audio only. Also when requesting the options it gives the same line for 22 times: min ch=1 bits=8 rate= 11025 max ch=2 bits=16 rate= 44100
You might use Voicemeeter instead of HIFI-Cable / ASIO-Bridge. Voicemeeter is a virtual audio device mixer able to connect everything together, any audio point, in any interface and any app together (including ASIO DAW)... Download & User Manual on www.voicemeeter.com
To answer my own question: it is not possible to capture sound from an ASIO device with ffmpeg. Maybe I will write the code for it if I need it...
I could however solve my issues by separating the two streams of audio data we have (AVB and Dante). These where on the same switch and maybe it is a bug in the firmware, maybe misconfiguration.
Thanks for your help!
How do I get the output from an ASIO device to IceCast2 or FFMpeg?
Duplicate?
And if not, Place the output for ffmpeg -f dshow -i "audio=your_device_name_in_dshow" -list_options

How to get absolute signal in PyAudio?

I'm trying to use pyaudio to analyze audio playing on my computer's system. To do this I am selecting a recording device called Stereo Mix as my input signal into pyaudio. Stereo Mix seems to be a recording device provided by my computer's soundcard, VIA High Definition Audio.
The problem is the signal I get from pyaudio changes in amplitude when I increase the volume on my computer. I would like to get an absolute signal which does not change with increased volume (ideally the raw signal generated from the computer's system). Does anyone have a solution this problem?
Thanks

watch for programms using audio output in linux

I would like to watch for programms outputing audio. Basically I try to make a system where I have VLC running in the background and if I start a video in firefox, VLC would automatically mute. Anyone have any idea how to do it ? A command line equivalent of pavucontrol would be cool I guess.
But a script or binary that would do something when there are more than one process that outputs audio would be really cool.
The NewPlaybackStream signal of the PulseAudio D-Bus interface will let you know when another application has begun playback (or technically when they've attached to the PulseAudio server, usually to play audio), and the opposite with PlaybackStreamRemoved.

Resources