Saturday, October 19, 2013

Raspberry Pi - Gstreamer streaming H.264 with OpenMax

On Rasbian:
* add the following line to /etc/apt/sources.list
deb http://vontaene.de/raspbian-updates/ . main
* install:
apt-get update
apt-get install libgstreamer1.0-0-dbg gstreamer1.0-tools libgstreamer-plugins-base1.0-0 \
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad-dbg gstreamer1.0-omx gstreamer1.0-alsa



Raspberry pi's pipeline:
gst-launch-1.0 -v videotestsrc ! 'video/x-raw, width=640, height=480, framerate=15/1' ! queue ! videoconvert ! omxh264enc ! rtph264pay pt=96 ! udpsink host=REMOTE_IP port=500




Linux's pipeline:
sudo gst-launch-0.10 udpsrc port=500 ! 'application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" ! gstrtpjitterbuffer mode=slave latency=200 drop-on-latency=true ! rtph264depay ! video/x-h264,width=640,height=480, framerate=30/1 ! ffdec_h264 ! ffmpegcolorspace ! xvimagesink


Sunday, April 07, 2013

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

Tuesday, February 19, 2013

V4L2 to FrameBuffer on Raspberry-pi


In the video I used a 1.8'' TFT display: Get more information


Backstage - An interview with Eric Cartman :)


Follows a simple piece of code to forward the Webcam on the Raspberry-pi's framebuffer. The code is not perfect, in comparison to the codes found on the Web I added the conversion "YUV to RGB32 to RGB16" to support Raspberry pi's framebuffer.



Sunday, February 10, 2013

FM Radio Receiver on Raspberry-Pi

How did I do?

The system is composed by the following components:
  • Raspberry-pi
  • FM Radio Receiver - Philips tea5767 i2c module (2$)
  • 3W×2 Mini Digital power Audio Amplifier Board - pam8403
  • Speaker



Pinout


Video

Photos

Saturday, February 02, 2013

Telepresence Project

Telepresence refers to a set of technologies which allow a person to feel as if they were present, to give the appearance of being present, or to have an effect, via telerobotics, at a place other than their true location. (Wikipedia)

The Project:

Goal: When a user logs into the system, this will communicate through an LCD, filmed by a webcam (mjpeg-Stream), information about your IP address.
Try It Now!

The system is composed by the following components:
  • Raspberry-pi
  • Webcam
  • Arudino Uno
  • Display LCD

Technical Details:

Raspberry Pi runs at start-up my HTTP-Server based on Qt (QHttpServer). Every time somebody connects, Server takes the ip-client and through queries to the site freegeoip it obtains information on the country of ip (also downlaods a Flag Gif).
Server generates a Bitmap to be sent over a Serial Connection to the Arduino Uno.
Ardunio Uno is connected with a SPI-module "ST7735R LCD controller chip", on which I wrote a simple firmware that converts the serial commands in 16bits-Color-Pixels on the 1.8' TFT Display.
To make the webcam stream I followed this guide Raspberrypi_mjpeg_streaming

Wednesday, January 30, 2013

Arduino 1.8" TFT Display - Remote Desktop over Serial Port

*** Simple Test ... Very Slow ***

Send grabbed Desktop Images (defined by the mouse position) to SerialPort on Arduino + SPI Display.

SW:
I have used : Qt + QtSerialPort

Arduino:
Arduino Uno + Usb cable

1.8'' TFT Display:
Chinese ebayer ST7735R LCD controller chip