billw
Posts: 363
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 19, 2017 6:43 pm

Thanks for reporting that 2 channel audio works. I have not had a 2 channel mic to try.

User avatar
jbeale
Posts: 3360
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 19, 2017 6:51 pm

At first I just tested touching the connectors and confirming there was a buzz on the R and L channels. Now, having tested with an actual microphone I find that the audio is rather distorted, especially louder sounds. However when I turn off PiKrellCam and just use arecord to generate a stereo wav file at 24kHz the audio is perfectly clear, so it may be something about the mp3 compression(?)

Further tests: the live streaming audio plays clearly in the browser, as long as the level is not too high. However, the same audio level recorded on the video sounds quite distorted during playback. Is the clipping level different?

Edit 2: I think there's some issue with stereo with video. When I change pikrellcam.conf back to 1 channel the audio playback on the video is clear and there is no issue. At the same volume, with 2 channel the audio on the video playback is in stereo, but it has a fast choppy sound, like a digital vibrato. Below are two short video clips including mono and stereo so you can hear the difference (the mic was lying on the floor. I also stomped on the floor a few times, so you could hear the overload response.) A third clip I assembled from live-captured system audio (Audacity), shows the streaming feature works OK in stereo.

mono https://youtu.be/O5fmkjAVm5s (OK)
stereo https://youtu.be/ITlvhLwoBJA (Choppy)
streaming stereo capture https://youtu.be/8Hs9CZqOuT8 (also OK)

I wonder if there is some special requirement for multiplexing stereo sound with video, which is different from mono sound. As you hear from the third video, the streaming stereo works OK.

User avatar
jbeale
Posts: 3360
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 20, 2017 3:06 am

billw wrote:
Sun Nov 19, 2017 6:43 pm
Thanks for reporting that 2 channel audio works. I have not had a 2 channel mic to try.
If you have any interest in this I'd be happy to order a PS3 Eye camera for delivery to you. I have used these before with RPi and they work with "arecord" for 1, 2, and 4-channel (!) audio input. You can forget about the fact it's also a low-res camera, and just use it as a cheap USB stereo mic. The sample rate is limited to 16k but the audio quality is actually pretty good. https://www.amazon.com/Sony-PlayStation ... B0072I2240

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 20, 2017 7:00 am

jbeale, have you tried the Eyecams as the mics for pikrellcam?
There should be a way to run a script to get images of the Eyecams at the same time?
Pikrellcam with Pi camera plus 4 eyecams, 16 mics :lol:
Probably will need a Pi2/3 to run that lot.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jbeale
Posts: 3360
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 20, 2017 3:43 pm

Gavinmc42 wrote:
Mon Nov 20, 2017 7:00 am
jbeale, have you tried the Eyecams as the mics for pikrellcam?
Tried it just now. I can confirm that the PS3 Eye camera does work as a USB mic for PiKrellCam, both mono and stereo mode, at 16k and also the PKC Pi1 default 24k sample rate (even though I thought PS3-Eye was limited to 16kHz sampling). The audio quality sounds pretty good to me, and I don't notice any issues.

The first time I tried it I got periodic brief silent dropouts every several seconds in the audio when streaming, and similar skipped intervals on recorded video. BUT it turns out that was caused by the fact that I had another background process running using the PIGPIO library which checks the gpio pin state every few microseconds (that might have been Ok on a quad-core Pi model, but too much for my poor Model A).

I'd encourage anyone who wants a cheap mono or stereo (or quad!) mic for your Pi to check out the PS3 eye cam, Ok so it's more bulky than a standard simple mono mic, but the audio quality is good despite not doing 44.1/48 kHz and it's hard to beat the price.

billw
Posts: 363
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 20, 2017 5:25 pm

jbeale wrote:
Mon Nov 20, 2017 3:06 am
If you have any interest in this I'd be happy to order a PS3 Eye camera for delivery to you. I have used these before with RPi and they work with "arecord" for 1, 2, and 4-channel (!) audio input.
Thanks for the offer, but I should just order one or two. I did not know there was such a cheap 2 channel option available.

In the case where you got bad stereo audio, can you in the meantime run a test, maybe two? Have a terminal open to your Pi
and cd to /run/pikrellcam.
Then when you start a record, prevent the mp3 from being deleted by making a hard link to it after you start recording:

Code: Select all

  $ cd /run/pikrellcam
# Start a pikrellcam record and to a ls to see the mp3 name being recorded,
  $ ln  xxx.mp3  test.mp3
  # Stop the record and test play the test.mp3
If the test.mp3 audio is bad, try one more test. Stop pikrellcam from the web page and run from a terminal:

Code: Select all

$ pikrellcam -ad 1
Do another record and there will be a /tmp/debug.wav to test play.

If the test.mp3 is bad then it's likely my bug and I'll need a 2 channel mic to pursue it, otherwise it will be something about the
boxing.

User avatar
jbeale
Posts: 3360
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 20, 2017 7:03 pm

Thanks billw. I have done what you suggested. Again, the mono recording with the PS3 Eye device works 100% OK.
In stereo mode, both the linked .mp3 file from /run/pikrellcam and the debug .wav file from /tmp show the same problem in stereo mode. Zooming into the files in Audacity I see a step-jump in the waveform every 13 milliseconds, if that tells you anything. Some steps are small or invisible but I think there is a definite 13 msec period to the steps.

Audacity screenshot viewing the debug stereo .wav file
https://photos.app.goo.gl/0wcxgmWg2sh3kHyv2

Update: I shut off pikrellcam and tried recording directly from the command line with:

Code: Select all

arecord -D plughw:1,0 -f dat -d 10 /home/pi/audio/test48b.wav
and the resulting wav file looks and sounds fine, no trace of the 13 msec steps. So the hardware seems OK.

Code: Select all

[email protected]:~/audio $ uname -a
Linux rp100 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux

[email protected]:~/audio $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: CameraB409241 [USB Camera-B4.09.24.1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
NOTE: previously I used a Model A+ but all of today's experiments were on a RPi 2 Model B (/proc/cpuinfo Revision: a21041)

Also, the PS3-Eye audio hardware can only do a 16 kHz sample rate, but apparently the Linux driver interpolates on the fly as necessary, because arecord will work without complaint right up to a sample rate of 192 kHz. I installed pulseaudio just to run this command to check:

Code: Select all

[email protected]:~/audio $ pactl list short sources
0	alsa_input.usb-OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1-01.multichannel-input	module-alsa-card.c	s16le 4ch 16000Hz	SUSPENDED
1	alsa_output.platform-soc_audio.analog-stereo.monitor	module-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED

User avatar
jbeale
Posts: 3360
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 21, 2017 12:04 am

In case of interest, the PS3 Eye Camera audio device data:

Code: Select all

[email protected]:~/audio $ pactl list sources
Source #0
	State: SUSPENDED
	Name: alsa_input.usb-OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1-01.multichannel-input
	Description: Sony Playstation Eye Multichannel
	Driver: module-alsa-card.c
	Sample Specification: s16le 4ch 16000Hz
	Channel Map: front-left,front-right,rear-left,rear-right
	Owner Module: 6
	Mute: no
	Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB,   rear-left: 65536 / 100% / 0.00 dB,   rear-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	Base Volume: 65536 / 100% / 0.00 dB
	Monitor of Sink: n/a
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "USB Audio"
		alsa.id = "USB Audio"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "1"
		alsa.card_name = "USB Camera-B4.09.24.1"
		alsa.long_card_name = "OmniVision Technologies, Inc. USB Camera-B4.09.24.1 at usb-3f980000.usb-1.5, hi"
		alsa.driver_name = "snd_usb_audio"
		device.bus_path = "platform-3f980000.usb-usb-0:1.5:1.1"
		sysfs.path = "/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.1/sound/card1"
		udev.id = "usb-OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1-01"
		device.bus = "usb"
		device.vendor.id = "1415"
		device.vendor.name = "Nam Tai E&E Products Ltd. or OmniVision Technologies, Inc."
		device.product.id = "2000"
		device.product.name = "Sony Playstation Eye"
		device.serial = "OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1"
		device.string = "hw:1"
		device.buffering.buffer_size = "256000"
		device.buffering.fragment_size = "128000"
		device.access_mode = "mmap+timer"
		device.profile.name = "multichannel-input"
		device.profile.description = "Multichannel"
		device.description = "Sony Playstation Eye Multichannel"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-usb"
	Formats:
		pcm

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 21, 2017 1:56 am

$2-6 for secondhand PS3 Eyecams, I used to get them 2-5 at a time.
Then I upgraded to Pikrellcam with Pi cams, so some are now lying around, just a dozen or so ;)

Perhaps an audio level threshold for still/video triggering can be the next option.
When my dogs bark I want all my cameras taking videos :D
The eyecams even with thermal noise are better at night in low light.
If you get the right version some can have their IR filters removed easily.
Last edited by Gavinmc42 on Tue Nov 21, 2017 4:23 am, edited 1 time in total.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jbeale
Posts: 3360
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 21, 2017 3:00 am

The PS3-eyecams that I got have the IR filter attached to the back of the lens, not mounted on the sensor. So if you hack the case apart and remove the lens (no clean way to do that, AFAIK) you have a bare sensor ready for IR experiments. I crudely hot-melt-glued a C-mount on one camera and tried a 6-60mm c-mount lens on it. That does work, but I wasn't too impressed with the overall image quality; at best it's still a 640x480 image. Most of my security cameras are now 2MP or 4MP Dahua IP cameras, because the image (esp. at night) is significantly better than anything the RPi camera can do. However I am also still running a number of PiKrellCam units because the web interface with the thumbnail page showing the day's events is much better and more convenient than the other software I have. Nothing wrong with the PS3-eye audio though, sound quality is as good or better than any other mic I have.

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 21, 2017 4:35 am

I think we can get better with the V1 Pi cam, there is a night mode that can integrate over 8 frames.
Only good for stills but that is ok for some apps.
I don't see these night mode registers getting written or used.
0x3A00 ,0x3A02, 0x3A03, 0x3A05....
I have not tried much night testing, still learning coding of camera stuff.

Sony probably has an equivalent but it would be NDAed?

Raspiraw post has some interesting stuff happening, raw monochrome sensors now looking possible.
Large pixel 2MP MIPI? Time to see what is out there with reasonable data sheets?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
underwhelmd
Posts: 93
Joined: Fri Jul 08, 2016 10:05 pm
Location: East Coast, Canada

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 21, 2017 5:24 am

jbeale wrote:
Tue Nov 21, 2017 3:00 am
Most of my security cameras are now 2MP or 4MP Dahua IP cameras, because the image (esp. at night) is significantly better than anything the RPi camera can do.
Hi, I'd like to know which model of these is your preference? Might try one out... thanks.

User avatar
jbeale
Posts: 3360
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 21, 2017 3:51 pm

I don't want to take this thread too far off-topic. If you're interested in IP cams: https://ipcamtalk.com/threads/dahua-2mp ... eup.14793/
Prices start around US$130 for the 2MP Starlight cams which are good at night. Clearly the RPi solution is less expensive and can give you acceptable night performance if you compensate with enough external light.

One of my RPi NoIR-type (3rd party) cams with f=12mm lens is used with some LED arrays, totaling about 8 watts of 850nm LEDs with 5 degree collimators (difficult to source assembled arrays that focused; I built it myself). That gives me usable Pi camera images to 80 ft. without resorting to slow shutter (= blurry frames). Normal illuminators with 45 deg. or wider beam spread don't work nearly as far, of course, as the power is spread out more thinly over a wider area.

User avatar
jbeale
Posts: 3360
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Nov 22, 2017 2:22 am

Back on the topic of PKC Audio Recording, I just now noticed the below output from 'dmesg' on my RPi Model A+. 16000 is the nominal max audio sample rate of the PS3 Eye device, so this may have something to do with the recording issues.

Code: Select all

[  903.379971] retire_capture_urb: 1 callbacks suppressed
[  903.454334] usb 1-1.2: current rate 13454 is different from the runtime rate 16000
[  904.015198] usb 1-1.2: current rate 4506 is different from the runtime rate 16000
[  904.433582] usb 1-1.2: current rate 3319 is different from the runtime rate 16000
[  904.744359] usb 1-1.2: current rate 2470 is different from the runtime rate 16000
[  905.258952] usb 1-1.2: current rate 4096 is different from the runtime rate 16000
[  905.845164] usb 1-1.2: current rate 4647 is different from the runtime rate 16000
[  908.045083] usb 1-1.2: current rate 17572 is different from the runtime rate 16000
[  909.513666] usb 1-1.2: current rate 11721 is different from the runtime rate 16000
[  909.514392] retire_capture_urb: 16 callbacks suppressed
[  909.875037] usb 1-1.2: current rate 2874 is different from the runtime rate 16000
[  913.229386] usb 1-1.2: current rate 26779 is different from the runtime rate 16000
[  913.597802] usb 1-1.2: current rate 2911 is different from the runtime rate 16000
[  914.208757] usb 1-1.2: current rate 4860 is different from the runtime rate 16000
[  918.465502] retire_capture_urb: 12 callbacks suppressed
[ 1024.126824] dwc_otg: DEVICE:003 : update_urb_state_xfer_comp:747:trimming xfer length

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Nov 22, 2017 12:42 pm

I suspect the A+ might be struggling so I tried on old P2.
Rates of 26557 and 1095505, audio seems to work fine, need to test more.
Not sure if the sample rate is actually reporting sample rate or access speed?

Fswebcam works, so 4 USB ports, got a UART JPEG camera somewhere.
One Pi, six cameras, bound to be issues.
Will need that 1GB for buffering, the BCM2836's single USB port will be maxing out?

Can fwebcam run on another core?
What is the Linux command to use other cores?
Does Pikrellcam use the other cores?
Any monochrome USB cameras out there?

Should just go out and get those Dahua IP cams :o
My head hurts trying to figure this new audio capability plus bonus cam with every 4 mics.
Phase/delay noise levels on mics can tell which way cars are going too?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
underwhelmd
Posts: 93
Joined: Fri Jul 08, 2016 10:05 pm
Location: East Coast, Canada

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Nov 25, 2017 11:15 pm

Can motion_confirm_gap be changed with an at-command? If so, what would be the syntax?

billw
Posts: 363
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 26, 2017 5:02 pm

underwhelmd wrote:
Sat Nov 25, 2017 11:15 pm
Can motion_confirm_gap be changed with an at-command? If so, what would be the syntax?
Example:

Code: Select all

daily   8:00  "@motion confirm_gap 6"

User avatar
underwhelmd
Posts: 93
Joined: Fri Jul 08, 2016 10:05 pm
Location: East Coast, Canada

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 26, 2017 5:14 pm

Thank you very much BillW

It's extremely handy to be able to automate changing profiles for different conditions. I appreciate your time.

Ouba
Posts: 11
Joined: Sun Jan 01, 2017 4:12 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 26, 2017 8:24 pm

Got the rtsp live streaming h264 OK

In the setup instruction I had to remove "-master" of the first line of this :

/root/gst-gateworks-apps-master/bin/gst-variable-rtsp-server -d 99 -p 8555 -m /stream.high \
-u "( tcpclientsrc port=3000 do-timestamp=true blocksize=262144 \
! video/x-h264,stream-format=byte-stream,profile=high \
! h264parse \
! rtph264pay name=pay0 pt=96 )" \

So the first line is :

/root/gst-gateworks-apps/bin/gst-variable-rtsp-server -d 99 -p 8555 -m /stream.high \

It works now !

Thanks again billw for the great work.

arnauld
Posts: 18
Joined: Wed Oct 14, 2015 2:12 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 26, 2017 9:21 pm

Hello,

I succeeded in adding a usb key to record on it the videos and stills, but they don't appear on the web page (video, stills, etc.).

I'd like thumbnails to appear the same way they appear when the videos and stills were recorded on a sd card.

Am I missing something ?

Thank you,

User avatar
underwhelmd
Posts: 93
Joined: Fri Jul 08, 2016 10:05 pm
Location: East Coast, Canada

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 26, 2017 10:16 pm

arnauld wrote:
Sun Nov 26, 2017 9:21 pm
Hello,

I succeeded in adding a usb key to record on it the videos and stills, but they don't appear on the web page (video, stills, etc.).

I'd like thumbnails to appear the same way they appear when the videos and stills were recorded on a sd card.

Am I missing something ?

Thank you,


permission issue?

arnauld
Posts: 18
Joined: Wed Oct 14, 2015 2:12 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 27, 2017 10:51 am

Hello,

I succeeded in adding a usb key to record on it the videos and stills, but they don't appear on the web page (video, stills, etc.).

I'd like thumbnails to appear the same way they appear when the videos and stills were recorded on a sd card.

Am I missing something ?

Thank you,


permission issue?
What I did is:

$ cd .pikrellcam
$ sudo nano pikrellcam.conf

I then changed "media_dir line" to the location of my USB drive.

"media_dir /media/pi/untitled" ("untitled" is the name of my usb key),

and edited "scripts/startup":
MOUNT_DISK=untitled

INSTALL_DIR=$1
MEDIA_DIR=$2
LOG_FILE=$3
I can see the pics and videos on my usb key (when I access it via ftp), but they don't appear on the web page

Image

As for the permissions what should I do ?

Thank you,

arnauld
Posts: 18
Joined: Wed Oct 14, 2015 2:12 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 27, 2017 2:02 pm

thank you @tomtgrp for the rtsp live video stuff,
and thank you @Ouba for the fix, I couldn't get it working till I read your fix about removing "master-".

billw
Posts: 363
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 27, 2017 4:23 pm

arnauld wrote:
Mon Nov 27, 2017 10:51 am
As for the permissions what should I do ?
If the USB disk is VFAT, permissions have to be set when mounted so the web pages can access the
disk from user www-data. Search for "umask" on the help page.

To avoid having to set special permissions when mounting, I just make a ext4 filesystem on my USB partitions. Then pikrellcam can
set up permissions automatically as needed.

arnauld
Posts: 18
Joined: Wed Oct 14, 2015 2:12 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 28, 2017 4:14 pm

I formated my usb key again, ext4 and followed this again :
$ cd .pikrellcam
$ sudo nano pikrellcam.conf

I then changed "media_dir line" to the location of my USB drive.

"media_dir /media/pi/untitled" ("untitled" is the name of my usb key),

and edited "scripts/startup":
MOUNT_DISK=untitled

INSTALL_DIR=$1
MEDIA_DIR=$2
LOG_FILE=$3
Do I have to edit something else ? Pikrellcam records videos and images on my usb key, but I don't see them on the webpage (no thumbnails...).

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 3 guests