Changes

Jump to: navigation, search

Uses cases with Naon Embedded Linux Kit

7,084 bytes added, 13:16, 4 December 2013
m
V4L2 Capture, decimanted
{{InfoBoxTop}}{{AppliesToNaonFamily}}{{Applies To NaonEVB-Lite}}{{Applies To NaonEVB-Mid}}{{InfoBoxBottom}}==InstroductionIntroduction==
This page lists some statistics and information about real use cases based on [[Naon Embedded Linux Kit (NELK)]].
===Gstreamer-based applications===For the sake of completeness, for each use case the full command line used to run the test application is provided. System software is based on [[Naon Embedded Linux Kit (NELK)]].
=== Performance ==='''N.B.''': before launching the gst pipelines, it is required to [http://bash.cyberciti.biz/guide/Source_command source] the /home/root/gst-nelk.sh included into the NELK root file system, which sets the following environment variables:
<pre>
export GST_REGISTRY=/home/root/gst-nelk_registry.bin
export LD_LIBRARY_PATH=/opt/gst/lib
export GST_PLUGIN_PATH=/opt/gst/lib/gstreamer-0.10
export PATH=/opt/gst/bin:$PATH
export GST_PLUGIN_SCANNER=/opt/gst/libexec/gstreamer-0.10/gst-plugin-scanner
</pre>
=== Video H264 RAW 1920x1080@25fpsdecoding and playing===Output is HDMI port connected to Full HD 46" TV screen.
CPU usage refers to the process under test as reported by <code>top</code> application.====Use case #1====* Description: playing H264 RAW video 1920x1080@25fps* CPU usage: 30%<preclass="board-terminal">
decode_display_a8host_debug.xv5T -w 1920 -h 1080 -f 25 -i /home/root/working-dir/battleship-ressurrecting_h1080p.h264
</pre>
====Use case #2====   Video mp4 * Description: playing H264 MP4 video 1920x1080@30fps demuxed video only video * CPU usage: 12%<preclass="board-terminal">
gst-launch filesrc location="/home/root/working-dir/1080p-131852575.mp4" ! qtdemux name=demux demux.video_00 ! queue ! nal2bytestream_h264 ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink
</pre>
====Use case #3====
* Description: playing two videos (both are hrdware decoded)
** video #1: H264 Raw 1920x1080 @25fps
** video #2: H264 Raw 848x360 @25fps
* CPU usage: 65%
<pre class="board-terminal">
gst-launch omx_videomixer port-index=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=816 sink_01::outX=0 sink_01::outY=0 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false filesrc location=/home/root/working-dir/480p-ice-int.h264 ! 'video/x-h264' ! h264parse access-unit=true ! omx_h264dec ! mix. filesrc location=/home/root/working-dir/iceage4-1080p.h264 ! 'video/x-h264' ! h264parse access-unit=true ! omx_h264dec ! mix.
</pre>
====Use case #4====
This section shows some different video combinations with overlayed text.
====Use case #4.1====
* Description: playing two videos (both are hardware decoded)
** video #1: H264 Raw 1920x1080 @25fps with ClockOverlay
** video #2: H264 Raw 848x360 @25fps
* CPU usage: 95%
<pre class="board-terminal">
gst-launch omx_videomixer port-index=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=816 sink_01::outX=360 sink_01::outY=150 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false filesrc location=/home/root/working-dir/480p-ice-int.h264 ! 'video/x-h264' ! h264parse access-unit=true ! omx_h264dec ! mix. filesrc location=/home/root/working-dir/iceage4-1080p.h264 ! 'video/x-h264' ! h264parse access-unit=true ! omx_h264dec ! clockoverlay halign=left valign=bottom text="UTC time:" shaded-background=true ! mix.
</pre>
====Use case #4.2====
* Description: playing two videos (both are hardware decoded) with no overlap
** video #1: H264 Raw 1920x1080 @25fps rescaled in hardware to 1280x720
** video #2: H264 Raw 848x360 @25fps with ClockOverlay
* CPU usage: 95%
<pre class="board-terminal">
gst-launch omx_videomixer port-index=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1280 sink_00::outHeight=720 sink_01::outX=1072 sink_01::outY=720 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false filesrc location=/home/root/working-dir/480p-ice-int.h264 ! 'video/x-h264,framerate=(fraction)30000/1252' ! h264parse access-unit=true ! omx_h264dec ! clockoverlay halign=center valign=bottom text="UTC time:" shaded-background=true ! mix. filesrc location=/home/root/working-dir/battleship-ressurrecting_h1080p.h264 ! 'video/x-h264,framerate=(fraction)30000/1252' ! h264parse access-unit=true ! omx_h264dec ! mix.
</pre>
[[File:PiPseparated.jpg|400px]]
====Use case #4.3====
* Description: playing two videos (both are hardware decoded)
** video #1: H264 MP4 1920x1080 @30fps demuxed only video
** video #2: H264 Raw 848x360 @25fps with ClockOverlay
* CPU usage: 92%
<pre class="board-terminal">
gst-launch omx_videomixer port-index=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=1080 sink_01::outX=360 sink_01::outY=150 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false filesrc location=/home/root/working-dir/480p-ice-int.h264 ! 'video/x-h264' ! h264parse access-unit=true ! omx_h264dec ! clockoverlay halign=center valign=bottom text="UTC time:" shaded-background=true ! mix. filesrc location="/home/root/working-dir/1080p-131852575.mp4" ! qtdemux name=demux demux.video_00 ! queue ! nal2bytestream_h264 ! omx_h264dec ! mix.
</pre>
[[File:PipFull.jpg|400px]]
Videos H264Raw ====Use case #4.4====* Description: playing two videos (both are hardware decoded)** video #1: H264 MP4 1920x1080 and @30fps demuxed only video** video #2: Streaming H264 video only, 320x240 rescaled in HW to 848x360 @25fpswith Clockoverlay* CPU usage: 30%<pre class="board-terminal">gst-launch omx_videomixer port-index=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=1080 sink_01::outX=360 sink_01::outY=150 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display-code=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false rtspsrc location=rtsp://192.168.0.33:5544 ! rtph264depay ! h264parse access-unit=true ! omx_h264dec ! clockoverlay halign=center valign=bottom text="UTC time:" shaded-background=true ! mix. filesrc location="/home/root/working-dir/1080p-131852575.mp4" ! qtdemux name=demux demux.video_00 ! queue ! nal2bytestream_h264 ! omx_h264dec ! mix.</pre>
====Use case #4.5====* Description: Stream H264 320x240 rescaled at 800x600* CPU 65usage: 9%<preclass="board-terminal">gst-launch rtspsrc location=rtsp://192.168.0.33:5544 ! rtph264depay ! h264parse access-unit=true ! omx_h264dec ! omx_scaler ! 'video/x-raw-yuv,width=800,height=600' !omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false</pre>====Use case #4.6====* Description: playing two videos (both are hardware decoded)** video #1: H264 MP4 1920x1080 @30fps demuxed only video** video #2: Streaming H264 video only, 320x240 rescaled in HW to 800x600 with Clockoverlay* CPU usage: 35%<pre class="board-terminal">gst-launch omx_videomixer port-index=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=816 1080 sink_01::outX=0 360 sink_01::outY=0 150 sink_01::outWidth=848 800 sink_01::outHeight=360 600 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false filesrc rtspsrc location=rtsp:/home/root/working-dir/480p-ice-int192.168.0.h264 33:5544 ! 'video/x-h264' rtph264depay ! h264parse access-unit=true ! omx_h264dec ! clockoverlay halign=center valign=bottom text="UTC time:" shaded-background=true ! mix. filesrc location="/home/root/working-dir/iceage41080p-1080p131852575.mp4" ! qtdemux name=demux demux.h264 video_00 ! 'video/x-h264' queue ! h264parse access-unit=true nal2bytestream_h264! omx_h264dec ! mix.
</pre>
[[File:PiPstreaming.jpg|400px]]
=== Video capture and encoding ===
==== V4L2 1080p60 Capture/HDMI display ====
* Description:
** 1080p60 video is captured from VIN0A using v4l2src gstreamer component
** output displayed on HDMI at the same resolution
Same videos with text in overlay on FullHD video. CPU 95%<preclass="board-terminal">gst-launch omx_videomixer port-indexv v4l2src device=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=816 sink_01::outX=360 sink_01::outY=150 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display"/dev/video0" always-mode=OMX_DC_MODE_1080P_60 ! omx_videosink synccopy=false filesrc locationqueue-size=/home/root/working6 num-dir/480pbuffers=-ice-int.h264 1 ! 'video/x-h264' ! h264parse accessraw-yuv-unitstrided,format=(fourcc)NV12,width=1920,height=true ! omx_h264dec ! mix. filesrc location1080,framerate=(fraction)60/home/root/working-dir/iceage4-1080p.h264 ! 'video/x-h2641' ! h264parse access-unitomxbufferalloc silent=false numBuffers=true 6 ! omx_h264dec omx_scaler ! clockoverlay halign=left valign=bottom text="UTC time:" shadedomx_ctrl display-backgroundmode=true OMX_DC_MODE_1080P_60 ! mix.gstperf ! omx_videosink sync=false
</pre>
==== V4L2 1080p60 Capture/H264 encoding/HDMI display ====
* Description:
** 1080p60 video is captured from VIN0A using v4l2src gstreamer component
** DEI/Scaler is used to split the source
** the former goes to H264 encoder (result saved to file)
** the latter goes to HDMI output
 Video 1920x1080 rescaled in HW and video 480p with textoverlay. CPU 95%<preclass="board-terminal">gst-launch omx_videomixer port-indexv4l2src device=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1280 sink_00::outHeight=720 sink_01::outX=1072 sink_01::outY=720 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display"/dev/video0" always-mode=OMX_DC_MODE_1080P_60 ! omx_videosink synccopy=false filesrc locationqueue-size=/home/root/working12 num-dir/480p-ice-int.h264 buffers=1000 ! 'video/x-h264raw-yuv-strided,format=(fourcc)NV12,width=1920,height=1080,framerate=(fraction)3000060/12521' ! h264parse access-unitomxbufferalloc silent=false numBuffers=true 12 ! omx_h264dec omx_mdeiscaler name=d d.src_01 ! clockoverlay halign omx_h264enc force-idr-period=center valign300 i-period=bottom text100 bitrate="UTC time:" shaded-background=true 5000000 ! mix. filesrc filesink location=/home/root/working-dir/battleship-ressurrecting_h1080pv4l2cap.h264 d.src_00 ! 'video/xomx_ctrl display-h264,frameratemode=(fraction)30000/1252' OMX_DC_MODE_1080P_60 ! gstperf ! h264parse accessomx_videosink display-unitmode=true ! omx_h264dec ! mix.OMX_DC_MODE_1080P_60
</pre>
==== V4L2 Capture, decimated ====
* Description
** 1080p50 video is captured from VIN1A using v4l2src
** input is decimated to 10 fps, using the same v4l2src
** output is displayed on HDMI
<pre class="board-terminal">
gst-launch -v v4l2src device="/dev/video2" always-copy=false queue-size=12 num-buffers=-1 decimate=5 ! 'video/x-raw-yuv-strided,format=(fourcc)NV12,width=1920,height=1080,framerate=(fraction)50/1' ! omxbufferalloc silent=false numBuffers=12 ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false
</pre>
==v4l2-based applications==
This section provides some examples of applications based on well-known [http://en.wikipedia.org/wiki/Video4Linux|Video4Linux API].
Video mp4 H264 1920x1080 and H264raw 480p with overlay. CPU 92%<pre>gst-launch omx_videomixer port-index=0 framerate=25 namesaLoopBack =mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=1080 sink_01::outX=360 sink_01::outY=150 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false filesrc location=/home/root/working-dir/480p-ice-int.h264 ! 'video/x-h264' ! h264parse access-unit=true ! omx_h264dec ! clockoverlay halign=center valign=bottom text="UTC time:" shaded-background=true ! mix. filesrc location="/home/root/working-dir/1080p-131852575.mp4" ! qtdemux name=demux demux.video_00 ! queue ! nal2bytestream_h264 ! omx_h264dec ! mix.</pre>
This sample program capture a video stream on v4l2 input and display the frames on v4l2 output. More information regarding the software can be found on [http://processors.wiki.ti.com/index.php/TI81XX_Video_Capture_Driver_User_Guide#saLoopBack this] TI wiki article.
== UVCcapture Tool ==
This utility take a snapshot for USB WebCAM using v4l2 driver class uvc
Videomix FullHD 1920x1080@30fps and streaming H264 only video 320x240 rescaled in HW with overlaydownload [http://staticwave.ca/source/uvccapture/uvccapture-0.5.tar.bz2 uvccapture], compile it on target
CPU 30%<preclass="board-terminal">gst$ wget http://staticwave.ca/source/uvccapture/uvccapture-launch omx_videomixer port0.5.tar.bz2$ tar xvjf uvccapture-index=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=1080 sink_01::outX=360 sink_01::outY=150 sink_01::outWidth=848 sink_01::outHeight=360 ! omx_ctrl display-code=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false rtspsrc location=rtsp://192.1685.tar.bz$ cd uvccapture-0.33:5544 ! rtph264depay ! h264parse access5$ make clean$ make all$ uvccapture -unit=true ! omx_h264dec ! clockoverlay halign=center valign=bottom text="UTC time:" shadedv -background=true ! mix. filesrc location="d/homedev/root/workingvideo0 -x1280 -y720 -dir/1080pt0 -131852575.mp4" ! qtdemux name=demux demux.video_00 ! queue ! nal2bytestream_h264 ! omx_h264dec ! mixosnapshot.jpg -q95
</pre>
== Dual EMAC mode (NaonEVB-Lite)==
The two Ethernet interfaces on [[Category:NaonEVB-Lite|NaonEVB-Lite]] can be used as:
* Ethernet switch: Linux sees only one Ethernet interface and packets are routed between the two ports like a standard Ethernet switch does.
* Dual EMAC Mode: Linux sees two independent Ethernet interfaces and packet are routed between the two like a Ethernet router does.
The default configuration provided with [[Naon Embedded Linux Kit (NELK)]] is ''Dual EMAC Mode'', where ''eth0'' is the [[Category:Naon|Naon]] on-board 10/100Mbit Ethernet interface, while eth1 is the [[Category:NaonEVB-Lite|NaonEVB-Lite]] Gigabit interface.
Stream H264 320x240 rescaled at 800x600 CPU 9%<pre>gst-launch rtspsrc location=rtspThe official TI documentation to enable and use Dual EMAC is [http://192processors.168wiki.0ti.33:5544 ! rtph264depay ! h264parse access-unit=true ! omx_h264dec ! omx_scaler ! 'videocom/x-raw-yuv,width=800,height=600' !omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false<index.php/pre>DM814x_AM387x_Ethernet_Switch_User_Guide#Dual_Standalone_EMAC_mode here]
Please note that no routing is enabled between the two interface is Dual EMAC mode by default. Linux userspace tool should be used to configure VLAN tagging and packet routing rules.
== Extending the root file system ==
NELK root file system derives directly from the one delivered along with TI EZSDK. In order to enrich it by installing new pre-built packages, well-known '''opkg''' tool comes to help.
Video mp4 1920x1080 The following instructions describes how to configure opkg in order to add more packages in order to provide a richer set of libraries, tools and streaming H264 320x240 rescaled at 800x600 with clockoverlay applications.
CPU 35%To configure opgk to retrieve pre-built packages from angstrom repository, please follow these instructions:
<pre>
gst$ echo "src/gz angstrom-launch omx_videomixer port-index=0 framerate=25 name=mix sink_00::outX=0 sink_00::outY=0 sink_00::outWidth=1920 sink_00::outHeight=1080 sink_01::outX=360 sink_01::outY=150 sink_01::outWidth=800 sink_01::outHeight=600 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false rtspsrc location=rtspbase http://192www.168.0.33:5544 ! rtph264depay ! h264parse accessangstrom-unit=true ! omx_h264dec ! clockoverlay halign=center valign=bottom text="UTC time:" shaded-background=true ! mixdistribution. filesrc location="org/feeds/unstable/homeipk/rootglibc/working-dirarmv7a/1080p-131852575.mp4base" ! qtdemux name=demux demux.video_00 ! queue ! nal2bytestream_h264! omx_h264dec ! mix>> /etc/opkg/opkg.conf$ opkg update
</pre>
    {{WorkInProgress}}Please note that '''packages provided by angstrom repository are not optimized for DM8148 media hardware blocks such as video codec'''. For this reason, pay attention to not replace DM8148-optimized applications and libraries provided by default root file system.

Navigation menu