How to capture at 1080p with LeopardBoard DM36x

From RidgeRun Developer Connection

Revision as of 17:32, 10 August 2012 by Mmadrigal (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to:navigation, search

Contents

Introduction

This whitepapers explains briefly how to configure your LeopardBoard DM368 to capture at 1080p.

Hardware needed

SDK Configuration

1. Select the MT9P031 driver to support your camera module

      Prompt: mt9p031 support
      Location:                                                                                                 
       -> Kernel configuration                                                                                    
         -> Device Drivers                                                                                        
           -> Multimedia support (MEDIA_SUPPORT [=y])                                                             
             -> Video capture adapters (VIDEO_CAPTURE_DRIVERS [=y])

2. Configure your SDK in order to be able to capture at 1080p as is shown below:

     Architecture configurations
           Video Output (Component)  --->                                                   
           Component Standard (1080I-30)  --->                                          
           Maximum Video Output Buffer Size (720P)  --->                            
           Maximum Video Input Buffer Size (1080P)  --->

3. Increase the reserved memory and the CMEM space to allocate the 1080p buffers.

    Proprietary Software
        [*] Reserve memory from the kernel for codec engine and friends automatically          
        (0x2bf7000) Amount of reserved memory from the kernel                     
        [*] Automatically setup CMEM at the beggining of the reserved memory area     
        (0x17f7000) Amount of reserved memory for cmemk 

4. If your target format is H264 and you are using an EVAL version of the SDK you will need to do the following modification into you MT9P031 driver:

Index: kernel/linux-2.6.32.17-psp03.01.01.39/drivers/media/video/mt9p031.c
===================================================================
--- kernel.orig/linux-2.6.32.17-psp03.01.01.39/drivers/media/video/mt9p031.c	2012-08-10 09:44:39.763840232 -0700
+++ kernel/linux-2.6.32.17-psp03.01.01.39/drivers/media/video/mt9p031.c	2012-08-10 09:45:20.195126497 -0700
@@ -204,7 +204,7 @@
     },
     {
     /* 1080P-HDTV */
-    .framesize = { 1920, 1080},
+    .framesize = { 1920, 1088},
     .frameintervals = {
         {  .numerator = 1, .denominator = 31 },
         },

This modification will allow use 1080p with the H264 encoder.

5. Re-built your SDK and install it into your board.

Use GStreamer to capture from the camera at 1080p

MJPEG Encoding

The following pipeline will capture a 1080p image and will encode it in JPEG to be saved to a file.

 FILE_NAME=image.jpeg

 gst-launch -e v4l2src num-buffers=1 always-copy=false ! 'video/x-raw-yuv,format=(fourcc)NV12, width=1920,height=1080' ! queue ! dmaiaccel ! dmaienc_mjpeg ! filesink location=$IMAGE_FILE

H264 Encoding

The following pipeline captures 1080p video and encode it in H264 to be saved into a file.

VIDEO_FILE=h264file.mp4

gst-launch -e v4l2src always-copy=false ! 'video/x-raw-yuv,format=(fourcc)NV12, width=1920,height=1088' ! queue ! dmaiaccel ! dmaienc_h264 encodingpreset=2 ratecontrol=2 ! qtmux ! filesink location=$VIDEO_FILE

NOTE: Due to codec limitations it is necessary to use 1920x1088 image size instead of 1920x1080. A specific modification must me done to accomplish this feature in the EVAL version (See previous section).

Navigation
Toolbox