Monday, March 25, 2013

Codec2

Lately I'm dealing with audio streaming, googling I found this interesting codec:
Codec2

From RoweTel

Codec2 is an open source low bit rate speech codec designed for communications quality speech at 2400 bit/s and below (also supports 3200|2400|1600|1400|1300|1200 bit/s). Applications include low bandwidth HF/VHF digital radio and VOIP trunking. Codec 2 operating at 2400 bit/s can send 26 phone calls using the bandwidth required for one 64 kbit/s uncompressed phone call. It fills a gap in open source, free-as-in-speech voice codecs beneath 5000 bit/s and is released under the GNU Lesser General Public License (LGPL). Here are some steps you can take to touch this technology:


Quick Start

To encode the file raw/hts1a.raw then decode to a raw file ( 8 kHz, 16 bit ints) hts1a_c2.raw:

$ svn co https://freetel.svn.sourceforge.net/svnroot/freetel/codec2-dev
$ cd codec2-dev
$ ./configure
$ make
$ cd src
$ ./c2demo ../raw/hts1a.raw hts1a_c2.raw
$ play -r 8000 -s -2 hts1a_c2.raw

Fun with pipes:

$ ./c2enc 1400 ../raw/morig.raw - | ./c2dec 1400 - - | play -t raw -r 8000 -s -2 -

Encode a voice file with Codec 2 at 1400 bit/s and send through FDMDV modem, play decoded audio:

$ ./c2enc 1400 ../raw/hts1a.raw - | ./fdmdv_mod - - | ./fdmdv_demod - - | ./c2dec 1400 - - | play -t raw -r 8000 -s -2 -


Extract from: c2qso.sh

A loopback test

$ gst-launch-0.10 alsasrc ! "audio/x-raw-int, endianss=(int)1234,signed=(boolean)true,width=(int)16,depth=(int)16,rate=8000,channels=1" ! audioconvert ! fdsink | ./c2enc 1400 - - | ./c2dec 1400 - - | play -t raw -r 8000 -s -2 -

With FDMDV Modem
the following lines of code have not been tested




Transmitter
$ gst-launch-0.10 alsasrc ! "audio/x-raw-int, endianss=(int)1234,signed=(boolean)true,width=(int)16,depth=(int)16,rate=8000,channels=1" ! audioconvert ! fdsink | ./c2enc 1400 - - | ./fdmdv_mod - - | play -t raw -r 8000 -s -2 -

Receiver
$ gst-launch-0.10 alsasrc ! "audio/x-raw-int, endianss=(int)1234,signed=(boolean)true,width=(int)16,depth=(int)16,rate=8000,channels=1" ! audioconvert ! fdsink | ./fdmdv_demod - - | ./c2dec 1400 - - | play -t raw -r 8000 -s -2 -

Simplex System Configuration Diagram on PMR and Raspberry Pi
RasParrot: System configuration diagram

Line level signal to microphone input adapter schema


Saturday, March 09, 2013

PTZ camera WiFi on Raspberry pi

Cheap chinese PTZ Camera WiFi(F-M136) 40$ controlled by Raspberry-pi



[GStreamer] Playback camera mjpeg-stream:

gst-launch souphttpsrc location=http://[CAMERA-IP]:[PORT]/videostream.cgi user-id=CAMERA_USER user-pw=CAMERA_PASSWORD ! decodebin ! ffmpegcolorspace ! autovideosink

[WGet] PTZ commands:

UP wget --user=CAMERA_USER --password=CAMERA_PASSWORD http://[CAMERA-IP]:[PORT]/decoder_control.cgi?onestep=1&command=0
DOWN
wget --user=CAMERA_USER --password=CAMERA_PASSWORD http://[CAMERA-IP]:[PORT]/decoder_control.cgi?onestep=1&command=2
LEFT
wget --user=CAMERA_USER --password=CAMERA_PASSWORD http://[CAMERA-IP]:[PORT]/decoder_control.cgi?onestep=1&command=4
RIGHT
wget --user=CAMERA_USER --password=CAMERA_PASSWORD http://[CAMERA-IP]:[PORT]/decoder_control.cgi?onestep=1&command=6


See also: IPCAM CGI SDK 2.1