LeopardBoard 365 GStreamer Pipelines - Legacy SDK

From RidgeRun Developer Connection

Revision as of 16:53, 20 May 2011 by Tfischer (Talk | contribs)
Jump to:navigation, search

The following examples show the usage of GStreamer with the RR DM365 Leopard board SDK. All the commands indicated in this examples are intended to be executed on the target, NOT the host.

Contents

Modifying audio levels

The sound should be heard on the headphones/speakers If the audio volume is too low, edit it by typing:

 / # alsamixer
Then increase the PCM and Line DAC levels.
Also if the sound is noisy activate the AGC option using alsamixer (key M toggles between mute and active).
┌───────────────────────────── AlsaMixer v1.0.21 ──────────────────────────────┐
│ Card: DaVinci EVM                                    F1:  Help               │
│ Chip:                                                F2:  System information │
│ View: F3:[Playback] F4: Capture  F5: All             F6:  Select sound card  │
│ Item: Line DAC [dB gain: -12.00, -12.00]             Esc: Exit               │
│                                                                              │
│     ┌──┐     ┌──┐              ┌──┐     ┌──┐     ┌──┐              ┌──┐      │
│     │  │     │  │              │ ▒│     │  │     │ ▒│              │▒ │      │
│     │▒▒│     │  │              │ ▒│     │  │     │ ▒│              │▒ │      │
│     │▒▒│     │▒▒│              │ ▒│     │  │     │ ▒│              │▒ │      >
│     │▒▒│     │▒▒│              │ ▒│     │  │     │ ▒│              │▒ │      >
│     │▒▒│     │▒▒│              │▒▒│     │▒▒│     │▒▒│              │▒▒│      >
│     │▒▒│     │▒▒│              │▒▒│     │▒▒│     │▒▒│              │▒▒│      >
│     │▒▒│     │▒▒│              │▒▒│     │▒▒│     │▒▒│              │▒▒│      >
│     │▒▒│     │▒▒│              │▒▒│     │▒▒│     │▒▒│              │▒▒│      >
│     │▒▒│     │▒▒│              │▒▒│     │▒▒│     │▒▒│              │▒▒│      >
│     │▒▒│     │▒▒│              │▒▒│     │▒▒│     │▒▒│              │▒▒│      │
│     │▒▒│     │▒▒│              │▒▒│     │▒▒│     │▒▒│              │▒▒│      │
│     └──┘     └──┘     ┌──┐     └──┘     └──┘     └──┘     ┌──┐     └──┘      │
│                       │OO│                                │OO│               │
│                       └──┘                                └──┘               │
│    82<>82   80<>80            60<>100    60     60<>100          100<>60     │
│     PCM   <Line DAC> LineL   LineL DA LineL Le LineL Li  LineR   LineR Li    │
|──────────────────────────────────────────────────────────────────────────────┘

Testing Audio Input

Audio Test Source

Connect an audio player device to the MIC jack and speakers/headphones to the OUT jack. We did not test with an actual microphone. Play some audio on the device and execute the next pipeline

gst-launch autoaudiosrc ! alsasink sync =false

Capturing audio from Line IN

gst-launch alsasrc ! alsasink sync=false


Testing Video Input

In order to display video the following commands must be executed: (When you boot your board the RidgeRun logo will be displayed)

loadmodules.sh
fbset -disable

Component output initialization

There's a known bug with the component output initialization. Before you play or capture video using the component output this commands must be executed on the target:

 echo "COMPOSITE" > /sys/class/davinci_display/ch0/output
 echo "COMPONENT" > /sys/class/davinci_display/ch0/output

Video and audio playback

Get a demo clip

wget -c http://downloads.dvdloc8.com/trailers/divxdigest/simpsons_movie_trailer.zip

Then unzip it

 unzip simpsons_movie_trailer.zip

And play it

 
gst-launch filesrc location= The\ Simpsons\ Movie\ -\ Trailer.mp4 ! qtdemux name=demux ! queue ! \
 dmaidec_h264 numOutputBufs=14 ! priority nice=-10 !  queue ! priority nice=-10 ! dmaiperf ! TIDmaiVideoSink  \
 accelFrameCopy=true videoOutput=component videoStd=720P_60  demux.audio_00 !queue ! priority nice=-5 ! dmaidec_aac ! alsasink

NOTE: Depending on the video displayed, the CMEM pools need to be modified to meet the requirements. This is needed when you execute a pipeline and the following error is displayed:

CMEMK Error: Failed to find a pool which fits <poolsize>

First you need the start and end addresses of the CMEM pools, these can be obtained executing loadmodules.sh and checking the output: a line like the next one will be printed

Loading CMEM from 0x<startaddr> to 0x<endaddr>

then type:

 rmmod cmemk
 modprobe cmemk phys_start=<startaddr> phys_end=<endaddr> pools=<somepools>, <mynewpools>

where <mynewpools> must be in format: <numberofpools>x<poolsize> (e.g 2x128). You may also need to resize/delete <somepools>

Video playback

Video test source

 
gst-launch videotestsrc ! TIDmaiVideoSink
gst-launch filesrc location= <filename>.mp4 ! qtdemux  name=demux ! queue ! dmaidec_mpeg4 numOutputBufs=14 ! TIDmaiVideoSink videoOutput=component videoStd=720P_60
gst-launch filesrc location= <filename>.mp4 ! qtdemux  name=demux ! queue ! dmaidec_mpeg4 numOutputBufs=14 ! TIDmaiVideoSink videoOutput=DVI videoStd=720P_60
gst-launch filesrc location= <filename>.mp4 ! qtdemux  name=demux ! queue ! dmaidec_mpeg4 ! TIDmaiVideoSink videoOutput=composite videoStd=D1_NTSC

Video streaming over the network

These instructions show how to do video streaming over the network, a video will be played on the board and viewed on the host.

Download the demo clip used in the previous section and execute the following pipeline

gst-launch filesrc location= The\ Simpsons\ Movie\ -\ Trailer.mp4 ! qtdemux \
name=demux ! queue ! rtph264pay ! udpsink host=<HOST_IP> port=10000 -v

where HOST_IP is your host machine IP (it can be obtained using ifconfig). Then ON THE HOST MACHINE execute

gst-launch udpsrc port=10000 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d4033, sprop-parameter-sets=(string)\"Z01AM5pzgKAItCAAMungCYloEeMGI8A\\=\\,aO48gA\\=\\=\", payload=(int)96, ssrc=(guint)1552450, clock-base=(guint)331037956, seqnum-base=(guint)59005' ! \
gstrtpjitterbuffer latency=500 ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! ximagesink -v

NOTE: Depending on some factors the video won't be reproduced with enough frames per second. This example is mainly intended to illustrate networking with the board. If you want to stream with higher FPS try with a lower resolution video.

Video capture

The previewer and resizer for video capture must be initialized by the user. In order to do that the application named IPIPE initializer must be installed on the target. On the configuration screen (make config) go to File System Configuration->Select target's file system software and select it.

Once it is installed, the previewer and resizer can be initialized by typing:

ipipe_init -d

The application has another options like white balance and brightness/contrast adjustment. You can explore them by using --help.

NOTE: The initialization must be done before any video capture session.

gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=640, height=480, framerate=\(fraction\)30/1 ! \
dmaiperf ! dmaiaccel ! TIDmaiVideoSink sync=false accelFrameCopy=false videoOutput=composite videoStd=D1_NTSC
gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=1280, height=720, framerate=\(fraction\)23/1 ! \
dmaiaccel ! dmaiperf ! TIDmaiVideoSink videoOutput=component sync=false accelFrameCopy=true videoStd=720P_60
gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=1280, height=720, framerate=\(fraction\)23/1 ! \
dmaiaccel ! dmaiperf ! TIDmaiVideoSink videoOutput=DVI sync=false accelFrameCopy=true videoStd=720P_60

Additional Examples

5Mpixel camera to the DVI output

Hardware: LeopardBoard 365, LI-5M03, LI-DVI1

Kernel Command Line video settings:

davinci_enc_mngr.ch0_output=DVI davinci_enc_mngr.ch0_mode=720P-60 davinci_display.cont2_bufsize=6291456 vpfe_capture.cont_bufoffset=6291456 vpfe_capture.cont_bufsize=6291456 video=davincifb:vid0=off:vid1=off:osd1=off dm365_imp.oper_mode=0 davinci_capture.device_type=4 vpfe_capture.interface=1

Commands:

loadmodules.sh
fbset -disable
ipipe_init -d
gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=1280, height=720, framerate=\(fraction\)23/1 ! dmaiaccel ! dmaiperf ! TIDmaiVideoSink videoOutput=DVI sync=false accelFrameCopy=true videoStd=720P_60

5Mpixel camera network streaming using H.264 and RTP

Hardware: LeopardBoard 365, LI-5M03


Kernel Command Line video settings:

vpfe_capture.cont_bufoffset=6291456 vpfe_capture.cont_bufsize=6291456 davinci_capture.device_type=4 vpfe_capture.interface=1


LeopardBoard 365 commands:

HOST_IP=10.111.0.3

loadmodules.sh
rmmod cmemk
modprobe cmemk phys_start=0x84200000 phys_end=0x88000000 pools=1x524288,1x81920,2x8192,6x4096,8x96,64x56,1x2938880,4x675840,1x75840,2x1548288,15x1253376,4x4147200
fbset -disable
ipipe_init -d
gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)NV12, width=1280, height=720, framerate=\(fraction\)23/1 ! dmaiaccel ! dmaiperf ! queue ! dmaienc_h264 ! rtph264pay ! udpsink host=$HOST_IP port=10000 -v

Host PC commands:

gst-launch udpsrc port=10000 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)640028, sprop-parameter-sets=(string)\"J2QAKK2IDkOYIOEMKQpEByHMEHCGFIUiA5DmCDhDCkKQwEIYwhxmMhCGAhDGEOMxkIQwEIYwhxmMhCICEZjOI8KfEfiP4j8R8R4ziMREQoEIjEcR4j5PxH8n5PiPEcRkiLQCgC3I\\,KO48sA\\=\\=\", payload=(int)96, ssrc=(guint)3543977897, clock-base=(guint)3621356901, seqnum-base=(guint)9820' ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! ximagesink -v
Navigation
Toolbox