LeopardBoard 365 GStreamer Pipelines - Legacy SDK

From RidgeRun Developer Connection

(Difference between revisions)
Jump to:navigation, search
(Video and audio playback)
m (5Mpixel camera network streaming using H.264 and RTP)
(27 intermediate revisions not shown)
Line 1: Line 1:
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.
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.
-
== Audio in ==
+
== Modifying audio levels ==
-
Connect an audio player device to the ''MIC'' jack and speakers/headphones to the ''OUT'' jack. Play some audio on the device and execute the next pipeline
+
 
-
gst-launch autoaudiosrc ! alsasink
+
The sound should be heard on the headphones/speakers
The sound should be heard on the headphones/speakers
If the audio volume is too low, edit it by typing:
If the audio volume is too low, edit it by typing:
-
alsamixer
 
-
then increase the ''PCM'' level. Also if the sound is noisy activate the ''AGC'' option using alsamixer (key M toggles between mute and active).
 
-
== Audio playback ==
+
<pre>
-
*Audio test source
+
  / # alsamixer
-
  gst-launch audiotestsrc ! alsasink
+
</pre>
-
If the audio volume is too low, edit it by typing:
+
:Then increase the '''PCM'''  and '''Line DAC''' levels.
-
alsamixer
+
:Also if the sound is noisy activate the ''AGC'' option using alsamixer (key M toggles between mute and active).
-
then increase the ''PCM'' level
+
-
== Video initialization ==
+
<pre>
-
When you boot your board the RidgeRun logo will be displayed, in order to display video the following commands must be executed:
+
┌───────────────────────────── AlsaMixer v1.0.21 ──────────────────────────────┐
-
loadmodules.sh
+
│ Card: DaVinci EVM                                    F1:  Help              │
-
  fbset -disable
+
│ 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    │
 +
|──────────────────────────────────────────────────────────────────────────────┘
 +
</pre>
 +
 
 +
== Loading needed modules ==
 +
 
 +
Before you can use the hardware accelerated GStreamer DMAI plug-in, you need to load the kernel drivers it requires.
 +
 
 +
<pre>
 +
loadmodules.sh
 +
</pre>
 +
 
 +
== 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
 +
 
 +
<pre>
 +
gst-launch autoaudiosrc ! alsasink sync =false
 +
</pre>
 +
 
 +
=== Routing Line In to Line Out ===
 +
 
 +
<pre>
 +
gst-launch alsasrc ! alsasink sync=false
 +
</pre>
 +
 
 +
=== Capturing Audio to AAC File ===
 +
 
 +
<pre>
 +
gst-launch -e alsasrc ! 'audio/x-raw-int,rate=(int)44100,channels=(int)2' ! dmaienc_aac bitrate=128000 ! qtmux ! filesink location=audio_aac.mp4
 +
</pre>
 +
 
 +
=== Capturing Audio to MP3 File ===
 +
 
 +
<pre>
 +
gst-launch -e alsasrc ! 'audio/x-raw-int,rate=(int)44100,channels=(int)2' ! dmaienc_mp3 bitrate=128000 ! filesink location=audio_mp3.mp3
 +
</pre>
 +
 
 +
== Enabling video window ==
 +
 
 +
When you boot, the OSD (on screen display), called frame buffer, has priority for the video output.  To enabled the video window to be visible, you need to run:
 +
 
 +
<pre>
 +
fbset -disable
 +
</pre>
== Component output initialization ==
== 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:
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:
 +
 +
<pre>
  echo "COMPOSITE" > /sys/class/davinci_display/ch0/output
  echo "COMPOSITE" > /sys/class/davinci_display/ch0/output
  echo "COMPONENT" > /sys/class/davinci_display/ch0/output
  echo "COMPONENT" > /sys/class/davinci_display/ch0/output
 +
</pre>
== Video and audio playback ==
== Video and audio playback ==
 +
*Output:component, mode:720P-60, package:mp4 (video:H.264, audio:AAC)
*Output:component, mode:720P-60, package:mp4 (video:H.264, audio:AAC)
 +
 +
Get a demo clip
<pre>
<pre>
 +
wget -c http://downloads.dvdloc8.com/trailers/divxdigest/simpsons_movie_trailer.zip
 +
</pre>
-
wget http://downloads.dvdloc8.com/trailers/divxdigest/simpsons_movie_trailer.zip
+
Then unzip it
-
unzip simpsons_movie_trailer.zip
+
<pre>
 +
unzip simpsons_movie_trailer.zip
 +
</pre>
-
gst-launch filesrc location= The\ Simpsons\ Movie\ -\ Trailer.mp4 ! qtdemux name=demux ! queue ! \
+
And play it
-
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
+
 +
<pre>
 +
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
</pre>
</pre>
-
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:
+
'''NOTE:''' Depending on the video displayed, the CMEM pools need to be modified to meet the requirements.  
-
  CMEMK Error: Failed to find a pool which fits <poolsize>
+
This is needed when you execute a pipeline and the following error is displayed:
 +
 
 +
<pre>
 +
CMEMK Error: Failed to find a pool which fits <poolsize>
 +
</pre>
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
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>
+
 
 +
<pre>
 +
Loading CMEM from 0x<startaddr> to 0x<endaddr>
 +
</pre>
then type:
then type:
 +
 +
<pre>
  rmmod cmemk
  rmmod cmemk
  modprobe cmemk phys_start=<startaddr> phys_end=<endaddr> pools=<somepools>, <mynewpools>
  modprobe cmemk phys_start=<startaddr> phys_end=<endaddr> pools=<somepools>, <mynewpools>
 +
</pre>
-
where <mynewpools> must be in format: <numberofpools>x<poolsize> (e.g 2x128). You may also need to resize/delete <somepools>
+
where <mynewpools> must be in format: <numberofpools>x<poolsize> (e.g 2x128).  
 +
You may also need to resize/delete <somepools>
== Video playback ==
== Video playback ==
-
*Video test source
+
===Video test source===
-
gst-launch videotestsrc ! TIDmaiVideoSink
+
<pre>
-
 
+
gst-launch videotestsrc ! TIDmaiVideoSink
 +
</pre>
*Output:component, mode: 720P_60, standard: mpeg-4
*Output:component, mode: 720P_60, standard: mpeg-4
  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=component videoStd=720P_60
Line 64: Line 153:
  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 numOutputBufs=14 ! TIDmaiVideoSink videoOutput=DVI videoStd=720P_60
-
*Output:composite, mode: 320x180, package: mp4
+
*Output:composite, mode: 640x360, package: mp4, standard: mpeg4
-
  gst-launch filesrc location= <filename>.mp4 ! qtdemux  name=demux ! queue ! dmaidec_h264 ! TIDmaiVideoSink videoOutput=composite videoStd=D1_NTSC
+
  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 ==
== Video capture ==
Line 71: Line 171:
Once it is installed, the previewer and resizer can be initialized by typing:
Once it is installed, the previewer and resizer can be initialized by typing:
-
  ipipe_init -d 1
+
  ipipe_init -d
The application has another options like white balance and brightness/contrast adjustment. You can explore them by using --help.
The application has another options like white balance and brightness/contrast adjustment. You can explore them by using --help.
Line 78: Line 178:
*Output:composite, mode:480P
*Output:composite, mode:480P
-
  gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=640, height=480, framerate=\(fraction\)30/1 ! dmaiperf ! dmaiaccel !  
+
  gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=640, height=480, framerate=\(fraction\)30/1 ! \
-
TIDmaiVideoSink sync=false accelFrameCopy=false videoOutput=composite videoStd=D1_NTSC
+
dmaiperf ! dmaiaccel ! TIDmaiVideoSink sync=false accelFrameCopy=false videoOutput=composite videoStd=D1_NTSC
*Output:component, mode:720P-60
*Output:component, mode: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 !  
+
  gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=1280, height=720, framerate=\(fraction\)23/1 ! \
-
TIDmaiVideoSink videoOutput=component sync=false accelFrameCopy=true videoStd=720P_60
+
dmaiaccel ! dmaiperf ! TIDmaiVideoSink videoOutput=component sync=false accelFrameCopy=true videoStd=720P_60
*Output:DVI, mode:720P-60
*Output:DVI, mode: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 !
+
  gst-launch -e v4l2src always-copy=false ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=1280, height=720, framerate=\(fraction\)23/1 ! \
-
TIDmaiVideoSink videoOutput=DVI sync=false accelFrameCopy=true videoStd=720P_60
+
dmaiaccel ! dmaiperf ! TIDmaiVideoSink videoOutput=DVI sync=false accelFrameCopy=true videoStd=720P_60
 +
 
 +
== Image capture ==
 +
 
 +
You also can capture JPEG images from the camera module. You can use the initializer mentioned above in order to do that or just do it directly from the pipeline using the property ''chain-ipipe'' of the v4l2src element (this feature has been added in our last versions of the SDK) the following pipelines capture a JPEG image for VGA and 720P resolutions using the MT9P031 sensor.
 +
 
 +
* VGA (640x480)
 +
 
 +
<pre>
 +
FILE_NAME=VGA_jpeg_file.jpg
 +
 
 +
gst-launch -e v4l2src always-copy=false num-buffers=1 chain-ipipe=true ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=640, height=480 ! \
 +
ffmpegcolorspace ! dmaienc_jpeg ! filesink location=$FILE_NAME
 +
</pre>
 +
 
 +
 
 +
* 720P (1280x720)
 +
 
 +
<pre>
 +
FILE_NAME=720P_jpeg_file.jpg
 +
 
 +
gst-launch -e v4l2src always-copy=false num-buffers=1 chain-ipipe=true ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=1280, height=720 ! \
 +
ffmpegcolorspace ! dmaienc_jpeg ! filesink location=$FILE_NAME
 +
</pre>
 +
 
 +
== Additional Examples ==
 +
 
 +
=== 5Mpixel camera to the DVI output ===
 +
 
 +
Hardware: LeopardBoard 365, LI-5M03, LI-DVI1
 +
 
 +
Kernel Command Line video settings:
 +
 
 +
<pre>
 +
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
 +
</pre>
 +
 
 +
Commands:
 +
 
 +
<pre>
 +
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
 +
</pre>
 +
 
 +
=== 5Mpixel camera network streaming using H.264 and RTP ===
 +
 
 +
 
 +
Hardware: LeopardBoard 365, LI-5M03
 +
 
 +
 
 +
Kernel Command Line video settings:
 +
 
 +
<pre>
 +
vpfe_capture.cont_bufoffset=6291456 vpfe_capture.cont_bufsize=6291456 davinci_capture.device_type=4 vpfe_capture.interface=1
 +
</pre>
 +
 
 +
 
 +
LeopardBoard 365 commands:
 +
 
 +
<pre>
 +
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
 +
 
 +
</pre>
 +
 
 +
Host PC commands:
 +
 
 +
<pre>
 +
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
 +
</pre>
 +
 
 +
 
 +
[[Category:DM36x]]  [[Category:LeopardBoard]]  [[Category:GStreamer]]

Revision as of 13:37, 25 August 2011

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    │
|──────────────────────────────────────────────────────────────────────────────┘

Loading needed modules

Before you can use the hardware accelerated GStreamer DMAI plug-in, you need to load the kernel drivers it requires.

loadmodules.sh

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

Routing Line In to Line Out

gst-launch alsasrc ! alsasink sync=false

Capturing Audio to AAC File

gst-launch -e alsasrc ! 'audio/x-raw-int,rate=(int)44100,channels=(int)2' ! dmaienc_aac bitrate=128000 ! qtmux ! filesink location=audio_aac.mp4

Capturing Audio to MP3 File

gst-launch -e alsasrc ! 'audio/x-raw-int,rate=(int)44100,channels=(int)2' ! dmaienc_mp3 bitrate=128000 ! filesink location=audio_mp3.mp3

Enabling video window

When you boot, the OSD (on screen display), called frame buffer, has priority for the video output. To enabled the video window to be visible, you need to run:

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

Image capture

You also can capture JPEG images from the camera module. You can use the initializer mentioned above in order to do that or just do it directly from the pipeline using the property chain-ipipe of the v4l2src element (this feature has been added in our last versions of the SDK) the following pipelines capture a JPEG image for VGA and 720P resolutions using the MT9P031 sensor.

FILE_NAME=VGA_jpeg_file.jpg

gst-launch -e v4l2src always-copy=false num-buffers=1 chain-ipipe=true ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=640, height=480 ! \
ffmpegcolorspace ! dmaienc_jpeg ! filesink location=$FILE_NAME


FILE_NAME=720P_jpeg_file.jpg

gst-launch -e v4l2src always-copy=false num-buffers=1 chain-ipipe=true ! video/x-raw-yuv,format=\(fourcc\)UYVY, width=1280, height=720 ! \
ffmpegcolorspace ! dmaienc_jpeg ! filesink location=$FILE_NAME

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