Difference between revisions of "CM-T3730: Linux: Camera"
(→Output to display) |
(→GStreamer) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 27: | Line 27: | ||
= Linux kernel = | = Linux kernel = | ||
− | All the use cases and examples in this article were tested with the | + | All the use cases and examples in this article were tested with the [http://compulab.co.il/products/computer-on-modules/cm-t3730/#devres CM-T3730 Linux package]. |
− | Kernel boot options and additional boot loader settings for hardware accelerated video stream encoding are described in [[CM-T3730: Linux: Angstrom#Kernel_parameters | Angstrom]] and [[CM-T3730: Linux: Video Playback#Boot_Loader_and_Linux_Kernel| Video Playback]] articles. | + | Kernel boot options and additional boot loader settings for hardware accelerated video stream encoding are described in [[CM-T3730: Linux: Angstrom#Kernel_parameters | Angstrom]], [[CM-T3730: Linux: Debian#Kernel_parameters | Debian]] and [[CM-T3730: Linux: Video Playback#Boot_Loader_and_Linux_Kernel| Video Playback]] articles. |
The following kernel configuration procedure is required : | The following kernel configuration procedure is required : | ||
Line 199: | Line 199: | ||
The {{cmd|media-ctl}} command line tool can be used to manipulate the Media Device through the Media Controller API. | The {{cmd|media-ctl}} command line tool can be used to manipulate the Media Device through the Media Controller API. | ||
This tool allows to enumerate media entities and their pads, set/get and enumerate links between pads of different entities, define pads data format. | This tool allows to enumerate media entities and their pads, set/get and enumerate links between pads of different entities, define pads data format. | ||
− | {{cmd|media-ctl}} package is included in the CM-T3730 Angstrom Linux root filesystem | + | {{cmd|media-ctl}} package is included in the CM-T3730 Angstrom and Debian Linux root filesystem images. |
== Explore Media Device == | == Explore Media Device == | ||
Line 378: | Line 378: | ||
== yavta == | == yavta == | ||
− | {{cmd|yavta}} (“Yet Another V4L2 Test Application”) is a data capture tool that allows to enumerate and set V4L2 device controls like brightness, exposure, autofocus etc. This is a generic tool that can be applied to any V4L2 compliant device. {{cmd|yavta}} package is included in the CM-T3730 Angstrom Linux root filesystem | + | {{cmd|yavta}} (“Yet Another V4L2 Test Application”) is a data capture tool that allows to enumerate and set V4L2 device controls like brightness, exposure, autofocus etc. This is a generic tool that can be applied to any V4L2 compliant device. {{cmd|yavta}} package is included in the CM-T3730 Angstrom and Debian Linux root filesystem images. |
=== Configure V4L2 device === | === Configure V4L2 device === | ||
Line 541: | Line 541: | ||
MPlayer has support for most modern video and audio formats. MPlayer is highly configurable, and can be controlled by keyboard, mouse, joystick or remote control (with LIRC). | MPlayer has support for most modern video and audio formats. MPlayer is highly configurable, and can be controlled by keyboard, mouse, joystick or remote control (with LIRC). | ||
− | MPlayer package is included in the CM-T3730 Angstrom Linux root filesystem image. | + | {{Note| MPlayer package is included in the CM-T3730 Angstrom Linux root filesystem image only.}} |
=== Streaming to display === | === Streaming to display === | ||
Line 717: | Line 717: | ||
This article demonstrates streaming and encoding video from camera with and without hardware acceleration capabilities of CM-T3730. | This article demonstrates streaming and encoding video from camera with and without hardware acceleration capabilities of CM-T3730. | ||
Please refer to [[CM-T3730: Linux: Video Playback | Video Playback]] article to get an overview of GStreamer framework, validate instalation and hardware acceleration support. | Please refer to [[CM-T3730: Linux: Video Playback | Video Playback]] article to get an overview of GStreamer framework, validate instalation and hardware acceleration support. | ||
− | GStreamer package is included in the CM-T3730 Angstrom Linux root filesystem | + | GStreamer package is included in the CM-T3730 Angstrom and Debian Linux root filesystem images. |
=== Streaming to display === | === Streaming to display === | ||
Line 1,140: | Line 1,140: | ||
* [http://www.ideasonboard.org/uvc/ Linux UVC driver and tools] | * [http://www.ideasonboard.org/uvc/ Linux UVC driver and tools] | ||
− | * [http://www. | + | * [http://www.omappedia.org/wiki/Camera-ISP_Driver Camera ISP Driver] |
* [http://www.mplayerhq.hu/ MPlayer official resource] | * [http://www.mplayerhq.hu/ MPlayer official resource] | ||
* [http://gstreamer.freedesktop.org/ GStreamer official resource] | * [http://gstreamer.freedesktop.org/ GStreamer official resource] | ||
− | |||
* [https://gstreamer.ti.com/gf/project/gstreamer_ti/ GStreamer TI Plugin] | * [https://gstreamer.ti.com/gf/project/gstreamer_ti/ GStreamer TI Plugin] | ||
* [http://www.angstrom-distribution.org/repo/ Ångström Distribution Feed browser] | * [http://www.angstrom-distribution.org/repo/ Ångström Distribution Feed browser] | ||
* [[CM-T3730: Linux: Getting started]] | * [[CM-T3730: Linux: Getting started]] | ||
* [[CM-T3730: Linux: Angstrom]] | * [[CM-T3730: Linux: Angstrom]] | ||
+ | * [[CM-T3730: Linux: Debian]] | ||
* [[CM-T3730: Linux: Kernel]] | * [[CM-T3730: Linux: Kernel]] | ||
* [[CM-T3730: Linux: Angstrom#Digital_Video_SDK | CM-T3730: Linux: Angstrom - Digital Video SDK]] | * [[CM-T3730: Linux: Angstrom#Digital_Video_SDK | CM-T3730: Linux: Angstrom - Digital Video SDK]] | ||
+ | * [[CM-T3730: Linux: Debian#Digital_Video_SDK | CM-T3730: Linux: Debian - Digital Video SDK]] | ||
* [[CM-T3730: Linux: Video Playback]] | * [[CM-T3730: Linux: Video Playback]] | ||
* [[Video Input Port Adapter Board]] | * [[Video Input Port Adapter Board]] |
Latest revision as of 11:43, 16 February 2014
Contents
- 1 Overview
- 2 Hardware Setup
- 3 Linux kernel
- 4 Setting up ISP Camera
- 5 Video support validation
- 6 Streaming tools
- 7 See also
Overview
CM-T3730 Linux supports various camera devices connected either to the USB subsystem or to the camera interface (CIF). This article describes both camera types setup, configuration and provides several usage examples.
Linux USB camera support is provided by USB Video Class (UVC) driver. All UVC compliant camera peripherals can be managed by the UVC driver. Linux also supports various non UVC cameras, but with some limitations. Therefore non UVC cameras are not covered in this article. Linux UVC driver implements the Video for Linux Two (V4L2) API. V4L2 is a suite of driver specifications for different types of video devices and video-related data. Examples in this article are using a AV301W-based camera.
The CM-T3730 module features camera image signal processor (ISP) that supports multiple formats and interfacing options for a wide variety of image sensors. OMAP ISP subsystem is supported by Linux OMAP3 Camera-ISP driver. In addition, any camera sensor requires appropriate sensor driver to be available. The OMAP3 Camera-ISP driver is a V4L2 framework driver that makes use of the Media Controller framework to configure the media hardware. Examples in this article are using the Aptina (Micron) MT9T031 3MP sensor and an NTSC analog composite camera.
Hardware Setup
USB camera does not require any special hardware setup. It can be connected to any SB-T35 USB Host port.
MT9T031 camera sensor (Micron MT9T031C12STCH demo head-board) is connected through the VIP-ADP to the OMAP camera ISP module.
Analog composite NTSC camera is connected with TVP5151 Video Decoder on the VIP-ADP board through the RCA composite input port.
VIP-ADP information and connection details are available in the Video Input Port Adapter Board article.
In this acticle MT9T031 sensor and TVP5151 decoder are referenced as ISP camera devices.
Video streaming to display examples provided in this article were tested with 1024x768 DVI monitor.
Linux kernel
All the use cases and examples in this article were tested with the CM-T3730 Linux package.
Kernel boot options and additional boot loader settings for hardware accelerated video stream encoding are described in Angstrom, Debian and Video Playback articles.
The following kernel configuration procedure is required :
Common media configuration
- Enable "Multimedia support" in the "Device Drivers" submenu:
┌──────────────────────────────── Device Drivers ─────────────────────────────────┐ │ ┌────^(-)─────────────────────────────────────────────────────────────────────┐ │ │ │ [*] Watchdog Timer Support ---> │ │ │ │ Sonics Silicon Backplane ---> │ │ │ │ Broadcom specific AMBA ---> │ │ │ │ -*- Multifunction device drivers ---> │ │ │ │ -*- Voltage and Current Regulator Support ---> │ │ │ │ <*> Multimedia support ---> │ │ │ │ Graphics support ---> │ │ │ │ <*> Sound card support ---> │ │ │ │ [*] HID Devices ---> │ │ │ └────v(+)─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────────────┘
- Enable "Video For Linux" and "Video capture adapters" in the "Multimedia support" submenu:
┌────────────────────────────── Multimedia support ───────────────────────────────┐ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ --- Multimedia support │ │ │ │ *** Multimedia core support *** │ │ │ │ [ ] Media Controller API (EXPERIMENTAL) │ │ │ │ <*> Video For Linux │ │ │ │ < > DVB for Linux │ │ │ │ *** Multimedia drivers *** │ │ │ │ <*> Remote Controller adapters ---> │ │ │ │ [ ] Load and attach frontend and tuner driver modules as needed │ │ │ │ [*] Customize analog and hybrid tuner modules to build │ │ │ │ Customize TV tuners ---> │ │ │ │ [*] Video capture adapters ---> │ │ │ │ [ ] Memory-to-memory multimedia devices ---> │ │ │ │ [*] Radio Adapters ---> │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────────────┘
USB Camera configuration
- Enable "V4L USB devices" in the "Video capture adapters" submenu:
┌──────────────────────────── Video capture adapters ─────────────────────────────┐ │ ┌────^(-)─────────────────────────────────────────────────────────────────────┐ │ │ │ [ ] Enable old-style fixed minor ranges for video devices │ │ │ │ [ ] Autoselect pertinent encoders/decoders and other helper chips │ │ │ │ <*> I2C module for IR │ │ │ │ Encoders, decoders, sensors and other helper chips ---> │ │ │ │ < > Virtual Video Driver │ │ │ │ < > VPFE Video Capture Driver │ │ │ │ < > OMAP2/OMAP3 V4L2-Display driver │ │ │ │ < > CPiA2 Video For Linux │ │ │ │ < > Support for timberdale Video In/LogiWIN │ │ │ │ < > SR030PC30 VGA camera sensor support │ │ │ │ < > NOON010PC30 CIF camera sensor support │ │ │ │ < > SoC camera support │ │ │ │ [*] V4L USB devices ---> │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────────────┘
- Enable "USB Video Class (UVC)" in "V4L USB devices" submenu:
┌──────────────────────────────── V4L USB devices ────────────────────────────────┐ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ --- V4L USB devices │ │ │ │ <*> USB Video Class (UVC) │ │ │ │ [*] UVC input events device support │ │ │ │ <M> GSPCA based webcams ---> │ │ │ │ < > Hauppauge WinTV-PVR USB2 support │ │ │ │ < > Hauppauge HD PVR support │ │ │ └────v(+)─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────────────┘
UVC camera and the driver do not need any special kernel command line parameters option.
ISP Camera configuration
- Enable "Media Controller API" in the "Multimedia support" submenu:
┌────────────────────────────── Multimedia support ───────────────────────────────┐ │ ┌────^(-)─────────────────────────────────────────────────────────────────────┐ │ │ │ *** Multimedia core support *** │ │ │ │ [*] Media Controller API (EXPERIMENTAL) │ │ │ │ <*> Video For Linux │ │ │ │ [*] V4L2 sub-device userspace API (EXPERIMENTAL) │ │ │ │ < > DVB for Linux │ │ │ │ *** Multimedia drivers *** │ │ │ │ < > Remote Controller adapters ---> │ │ │ │ [ ] Load and attach frontend and tuner driver modules as needed │ │ │ │ [ ] Customize analog and hybrid tuner modules to build │ │ │ │ [*] Video capture adapters ---> │ │ │ │ [ ] Memory-to-memory multimedia devices ---> │ │ │ │ [ ] Radio Adapters ---> │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────────────┘
- Enable "OMAP 3 Camera support" in the "Video capture adapters" submenu:
┌──────────────────────────── Video capture adapters ─────────────────────────────┐ │ ┌────^(-)─────────────────────────────────────────────────────────────────────┐ │ │ │ Encoders, decoders, sensors and other helper chips ---> │ │ │ │ < > Virtual Video Driver │ │ │ │ < > VPFE Video Capture Driver │ │ │ │ <*> OMAP2/OMAP3 V4L2-Display driver │ │ │ │ < > CPiA2 Video For Linux │ │ │ │ < > Support for timberdale Video In/LogiWIN │ │ │ │ < > SR030PC30 VGA camera sensor support │ │ │ │ < > NOON010PC30 CIF camera sensor support │ │ │ │ < > Fujitsu M-5MOLS 8MP sensor support │ │ │ │ <*> OMAP 3 Camera support (EXPERIMENTAL) │ │ │ │ [ ] OMAP 3 Camera debug messages │ │ │ │ < > SoC camera support │ │ │ └────v(+)─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────────────┘
- Enable "Texas Instruments TVP5150 video decoder" and "Aptina MT9T001 support" in the "Encoders, decoders, sensors and other helper chips" submenu:
┌────────────── Encoders, decoders, sensors and other helper chips ───────────────┐ │ ┌────^(-)─────────────────────────────────────────────────────────────────────┐ │ │ │ < > Texas Instruments TVP514x video decoder │ │ │ │ <*> Texas Instruments TVP5150 video decoder │ │ │ │ < > Texas Instruments TVP7002 video decoder │ │ │ │ < > vpx3220a, vpx3216b & vpx3214c video decoders │ │ │ │ *** Video and audio decoders *** │ │ │ │ < > Philips SAA7171/3/4 audio/video decoders │ │ │ │ < > Conexant CX2584x audio/video decoders │ │ │ │ *** MPEG video encoders *** │ │ │ │ < > Conexant CX2341x MPEG encoders │ │ │ │ *** Video encoders *** │ │ │ │ < > Philips SAA7127/9 digital video encoders │ │ │ │ < > Philips SAA7185 video encoder │ │ │ │ < > Analog Devices ADV7170 video encoder │ │ │ │ < > Analog Devices ADV7175 video encoder │ │ │ │ < > ADV7343 video encoder │ │ │ │ < > AK8813/AK8814 video encoders │ │ │ │ *** Camera sensor devices *** │ │ │ │ < > OmniVision OV7670 sensor support │ │ │ │ < > Aptina MT9P031 support │ │ │ │ <*> Aptina MT9T001 support │ │ │ │ < > Micron mt9v011 sensor support │ │ │ └────v(+)─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────────────┘
Setting up ISP Camera
Typical image grabbing and display operations are managed by several sub-blocks responsible for data processing like resizing, format conversion etc. For instance, the MT9T031 sensor produces RAW Bayer 10bit image data that could be captured without any processing or redirected to OMAP ISP Preview Engine to obtain image in YUV4:2:2 format.
The video input path can consist of various low level components (such as previewers, resizers, color space converters, etc). The components are a part of the video input path topology, that can be explored and modified by the Media Controller framework.
The OMAP3 Camera-ISP driver implements Media Controller API and supports the following hardware blocks: Sensor, CSI2, CCP2, CCDC, Preview, Resizer, H3A AEWB, H3A AF and Histogram. The hardware blocks are called Media Entities and can be accessed through Media Device. Each Media Device is exposed to user space through a device file (e.g. /dev/media0). Each Media Entity has one or more input and output Pads and is connectable to another entity through a Link.
The media-ctl command line tool can be used to manipulate the Media Device through the Media Controller API. This tool allows to enumerate media entities and their pads, set/get and enumerate links between pads of different entities, define pads data format. media-ctl package is included in the CM-T3730 Angstrom and Debian Linux root filesystem images.
Explore Media Device
Enumerate Media Entities and print the Media Device topology (/dev/media0 by default):
media-ctl -p
The following output corresponds to entity number 16 which is MT9T031 camera sensor in this example.
... - entity 16: mt9t001 3-005d (1 pad, 1 link) type V4L2 subdev subtype Unknown device node name /dev/v4l-subdev8 pad0: Output [SGRBG10 2048x1536 (32,20)/2048x1536] -> 'OMAP3 ISP CCDC':pad0 []
Camera sensor Media Entity properties in details:
mt9t001 3-005d | Name of the camera device registered in CM-T3730 board support file where 3-005d is the I2C bus number and device address. |
/dev/v4l-subdev8 | V4L2 Video device node associated with this entity which is independently configurable through its own set of file operations (if any registered) |
pad0: Output | pad0 is an output pad |
[SGRBG10 2048x1536 (32,20)/2048x1536] | pad0 is configured for - RAW Bayer 10bit image format with dimensions 2048x1536. The image window is cropped. The crop rectangle corner is defined by raw and column coordinates (32,20) and the crop window width and height 2048x1536. Default crop settings define a maximum MT9T031 sensor window size. Crop settings are used to provide desired resolution, establish electronic panning and control the frame rate. For more details see camera documentation. |
-> 'OMAP3 ISP CCDC':pad0 [] | Output pad0 of the Sensor is linked to the input pad0 of "OMAP3 ISP CCDC" entity. Empty brackets specify non active link. |
Camera ISP data paths
Data paths (pipelines) inside the camera ISP hardware depend on the image format sourced by the sensor (RAW Bayer, YUV4:2:2, JPEG,...). ISP driver supports different pipelines. To setup the Media Device links and formats properly, please refer to the Camera ISP section in the DM3730 technical reference manual.
RAW Data Path
The following chart shows various pipelines relevant to MT9T031 sensor that produces RAW Bayer 10bit image data.
RAW data are processed by the CCDC module and are directly pipelined to the Preview engine (1). Another way is to output directly from the CCDC to memory (C). In the Preview block, the format is converted from RAW data to YUV4:2:2. The data can be output to memory (4) or pipelined to the Resizer (2). The rescaled YUV4:2:2 image is finally stored in memory (3).
Following pipelines for image capturing are valid with MT9T031 sensor:
- Sensor->CCDC->Memory - (C)
- Sensor->CCDC->Preview->Memory - (1), (4)
- Sensor->CCDC->Preview->Resizer->Memory - (1), (2), (3)
YUV4:2:2 Data Path
The following chart shows various pipelines relevant to TVP5151 decoder. The TVP5151 decoder can be configured for output the data in 8-bit YUV4:2:2 with discrete sync output format or 8-bit ITU−R BT.656 with embedded sync output format (which also implements 4:2:2 sampling). The modules in red in the chart below are not used when the format is YUV4:2:2.
When the sensor-output format is YUV4:2:2, the CCDC block is pipelined to the resizer (1) or directly to memory (C). The rescaled YUV4:2:2 images are finally stored in memory (2).
Following pipelines for image capturing are valid with TVP5151 decoder:
- Sensor->CCDC->Memory - (C)
- Sensor->CCDC->Resizer->Memory - (1), (2)
Setting up ISP pipeline
This section describes how to translate valid ISP pipelines into links between Media Entities using media-ctl utility.
Following example demonstrates setting ISP pipeline for MT9T031 sensor to Sensor->CCDC->Preview->Memory and configuring entity pads formats.
Set up ISP pipeline:
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], \ "OMAP3 ISP preview":1->"OMAP3 ISP preview output":0[1]'
-r | Reset all links to inactive |
-l | Set up links by comma-separated list of links descriptors |
"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1] | Link output pad number 0 of Camera sensor to CCDC input pad number 1 and set this link active |
"OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1] | Link output pad number 2 of CCDC to Preview input pad number 0 and set this link active |
"OMAP3 ISP preview":1->"OMAP3 ISP preview output":0[1] | Link output pad number 1 of Preview to Preview Output input pad number 0 and set this link active |
Configure pads formats:
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 2048x1536 (32,20)/2048x1536], "OMAP3 ISP CCDC":2 [SGRBG10 2048x1536], \ "OMAP3 ISP preview":1 [UYVY 2048x1536]'
-f | Set up pads formats by comma-separated list of formats descriptors |
"mt9t001 3-005d":0 [SGRBG10 2048x1536 (32,20)/2048x1536] | Set up Camera sensor pad number 0 format to RAW Bayer 10bit image with resolution 2048x1536. Set maximum allowed sensor window width by specifying crop rectangle. |
"OMAP3 ISP CCDC":2 [SGRBG10 2048x1536] | Set up CCDC pad number 2 format to RAW Bayer 10bit image with resolution 2048x1536. |
"OMAP3 ISP preview":1 [UYVY 2048x1536] | Set up Preview pad number 1 format to YUV4:2:2 image with resolution 2048x1536. |
Video support validation
USB Camera
Check that your camera has been recognized correctly through the kernel debug messages log (using the dmesg command):
usb 1-2.2: New USB device found, idVendor=1871, idProduct=0f01 usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 1-2.2: Product: USB2.0 Camera usb 1-2.2: Manufacturer: AVEO Technology Corp. usb 1-2.2: usb_probe_device usb 1-2.2: configuration #1 chosen from 1 choice usb 1-2.2: adding 1-2.2:1.0 (config #1, interface 0) uvcvideo 1-2.2:1.0: usb_probe_interface uvcvideo 1-2.2:1.0: usb_probe_interface - got id uvcvideo: Found UVC 1.00 device USB2.0 Camera (1871:0f01) input: USB2.0 Camera as /devices/platform/usbhs-omap.0/ehci-omap.0/usb1/1-2/1-2.2/1-2.2:1.0/input/input7 usb 1-2.2: adding 1-2.2:1.1 (config #1, interface 1)
Also, the /dev/video0 device special file should be created.
ISP Camera
VIP-ADP can be configured to communicate with a single camera device at a time, either digital camera sensor or analog composite camera.
Depending on VIP-ADP configuration settings check that camera device and ISP module have been recognized correctly through the kernel debug messages log (using the dmesg command):
- OMAP ISP
Linux media interface: v0.10 Linux video capture interface: v2.00 omap3isp omap3isp: Revision 15.0 found omap-iommu omap-iommu.0: isp: version 1.1 ...
- TVP5151
... tvp5150 3-005c: chip found at address 0x5c (OMAP I2C adapter) tvp5150 3-005c: *** tvp5151 chip detected. tvp5150 3-005c: *** Rom ver is 1.0
- MT9T0031
... mt9t001 3-005d: Probing MT9T001 at address 0x5d mt9t001 3-005d: MT9T001 detected at address 0x5d
Also, the /dev/media0 device special file should be created.
To ensure proper Media Device initialization, print its topology by running
media-ctl -p
Each listed Media Entity should have an associated V4L2 video device. Pay special attention to the camera device entity. It must be present in the list.
Streaming tools
Linux provides a variety of streaming tools for the V4L2 compliant devices. We provide several examples that do not necessarily require an X Window System to operate your camera and capture images.
yavta
yavta (“Yet Another V4L2 Test Application”) is a data capture tool that allows to enumerate and set V4L2 device controls like brightness, exposure, autofocus etc. This is a generic tool that can be applied to any V4L2 compliant device. yavta package is included in the CM-T3730 Angstrom and Debian Linux root filesystem images.
Configure V4L2 device
V4L2 device typically has a number of configurable controls. yavta allows the controls enumeration and configuration.
Run the following command to print the list of all available controls of the Camera sensor exposed through /dev/v4l-subdev8. Output below corresponds to MT9T031 sensor.
root@cm-t35:~# yavta --list-controls /dev/v4l-subdev8 Device /dev/v4l-subdev8 opened. --- User Controls (class 0x00980001) --- control 0x0098090b `Black Level' min 1 max 1 step 1 default 1 current 1. control 0x00980911 `Exposure' min 1 max 1048576 step 1 default 1561 current 1700. control 0x00981901 `Test pattern' min 0 max 1023 step 1 default 0 current 0. control 0x00981902 `Black Level, Auto' min 0 max 1 step 1 default 1 current 1. control 0x00981903 `Black Level, Offset' min -256 max 255 step 1 default 32 current 32. control 0x00981904 `Black Level, Calibrate' min 0 max 0 step 0 default 0 current n/a. --- Camera Controls (class 0x009a0001) --- control 0x009a1001 `Gain, Red' min 8 max 1024 step 1 default 8 current 8. control 0x009a1002 `Gain, Green (R)' min 8 max 1024 step 1 default 8 current 8. control 0x009a1003 `Gain, Green (B)' min 8 max 1024 step 1 default 8 current 8. control 0x009a1004 `Gain, Blue' min 8 max 1024 step 1 default 8 current 8.
Following command will change the sensor exposure to 1000:
yavta --set-control '0x00980911 1000' /dev/v4l-subdev8
ISP Media Entity can be referred by name using media-ctl -e option. For example, OMAP3 ISP Preview entity V4L2 device controls can be explored by the following command:
root@cm-t35:~# yavta --list-controls `media-ctl -e "OMAP3 ISP preview"` Device /dev/v4l-subdev3 opened. --- User Controls (class 0x00980001) --- control 0x00980900 `Brightness' min 0 max 255 step 1 default 0 current 0. control 0x00980901 `Contrast' min 0 max 255 step 1 default 16 current 16. 2 controls found.
yavta parameters for configuring V4L2 device
-l, --list-controls | List available controls. |
-w, --set-control 'ctrl value' | Set control 'ctrl' to 'value'. |
--enum-formats | Enumerate formats supported by video device. |
--enum-inputs | Enumerate inputs of video device. Useful to find out video format details of specific input. That is video format name and ID, frame dimensions and buffer size. |
Capture stills images
Capturing stills images from ISP Camera can be done using several ISP pipelines. Examples below show how to setup appropriate pipeline, set pads format and capture an image using yavta.
MT9T031
Run the following set of commands to capture an image from Sensor->CCDC->Memory pipeline (capture RAW Bayer 10bit image from CCDC):
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 2048x1536 (32,20)/2048x1536], "OMAP3 ISP CCDC":1 [SGRBG10 2048x1536]'
yavta -f SGRBG10 -s 2048x1536 --capture=1 --file=image /dev/video2
Run the following set of commands to capture an image from Sensor->CCDC->Preview->Memory pipeline (capture YUV4:2:2 image from the Previewer):
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], \ "OMAP3 ISP preview":1->"OMAP3 ISP preview output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 2048x1536 (32,20)/2048x1536], "OMAP3 ISP CCDC":2 [SGRBG10 2048x1536], \ "OMAP3 ISP preview":1 [UYVY 2048x1536]'
yavta -f UYVY -s 2030x1527 --capture=1 --file=image /dev/video4
Run the following set of commands to capture an image from Sensor->CCDC->Preview->Resizer->Memory pipeline (capture YUV4:2:2 image from the resizer):
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], \ "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 1280x1024], "OMAP3 ISP CCDC":2 [SGRBG10 1280x1024], \ "OMAP3 ISP preview":1 [UYVY 1280x1024], "OMAP3 ISP resizer":1 [UYVY 1024x768]'
yavta -f UYVY -s 1024x768 --capture=1 --file=image /dev/video6
TVP5151
Run the following set of commands to capture an image from Sensor->CCDC->Memory pipeline (capture YUV4:2:2 image from CCDC):
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
yavta -f UYVY -s 720x524 --capture=1 --file=image /dev/video2
yavta parameters for capturing images
-f UYVY | Set the video format to UYVY. |
-s 1024x768 | Set the frame size 1024x768. |
--capture=1 | Capture one frame. |
--file=image | Write frame to a file image-000000.bin. |
/dev/video6 | Specify video capture device. |
Displaying captured images
MT9T031 camera sensor produces RAW Bayer 10bit image data. The raw data can be captured directly from ISP CCDC or after processing by Preview/Resizer in YUV4:2:2 format.
RAW Bayer array requires demosaicing, white balance setting and other processing steps. It can be done by UFRaw tool:
ufraw image-000000.bin
YUV4:2:2 image can be viewed by display tool from the ImageMagic application package. For instance, in order to view the image captured from MT9T031 sensor through Preview module in the example above run the following set of commands:
mv image-000000.bin image-000000.uyvy
display -size 2031x1527 -colorspace rgb image-000000.uyvy
Image captured through TVP5151 decoder from camera connected to composite input of VIP-ADP module requires deinterlacing. |
Converting captured images
YUV4:2:2 image captured from the camera can be converted to JPEG using TI DMAI GStreamer plugin. An overview of GStreamer multimedia framework is described further in this acticle.
To convert the image captured from MT9T031 sensor through Preview module in the example above run the following command:
gst-launch filesrc location=image-000000.bin ! TIImgenc1 resolution=2032x1527 iColorSpace=UYVY oColorSpace=YUV420P qValue=75 ! \ filesink location=image-000000.jpeg
To convert the image captured through TVP5151 decoder through CCDC module in the example above run the following command:
gst-launch filesrc location=image-000000.bin ! TIImgenc1 resolution=720x524 iColorSpace=UYVY oColorSpace=YUV420P qValue=75 ! \ filesink location=image-000000.jpeg
MPlayer
MPlayer has support for most modern video and audio formats. MPlayer is highly configurable, and can be controlled by keyboard, mouse, joystick or remote control (with LIRC).
MPlayer package is included in the CM-T3730 Angstrom Linux root filesystem image only. |
Streaming to display
USB Camera
The following command can be used to stream the USB camera output to the display using default configuration settings.
mplayer tv:// -vo omapfb
Press q or ESC to stop playing and quit program.
Adding more parameters will do some customization as shown below.
mplayer tv:// -tv driver=v4l2:width=800:height=600:device=/dev/video0:brightness=80:contrast=10:saturation=-30 -fs \ -vf mirror -vo omapfb
Parameters description:
mplayer tv:// | Stream data using TV capture module | ||
-tv | This option tunes various properties of the TV capture module (see below). | ||
|
Set TV input driver. | ||
|
Output window width and height. | ||
|
Specify TV device. | ||
|
Specify the output format of the TV device. | ||
|
Set the image equalizer. | ||
-fs | Fullscreen playback. Note: -fs is not necessarily supported by all MPlayer video output drivers. | ||
-vf | Video filters allow modification of the video stream and its properties. | ||
|
Mirrors the image on the Y axis. | ||
|
Allows acquiring screenshots of the movie. Make sure that the screenshot filter is the last filter, so the exact picture on the display will be saved. | ||
|
Crops the 720x480 part of the image from position (0,44) and discards the rest. | ||
|
Enables linear interpolating deinterlacing sub-filter. | ||
-vo | Specifies MPlayer video output driver. | ||
|
TI OMAP video frame buffer output. | ||
|
Separate output window if using X Window System. |
To start X Window application (e.g. MPlayer) from your serial console, the DISPLAY environment variable must be set. |
- Additional example for streaming USB camera output to a separate window in the X Window system:
mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -vo xv
MT9T031
Following set of commands will set up ISP pipeline to Sensor->CCDC->Preview->Resizer->Memory and stream 1024x768 video from MT9T031 sensor to OMAP framebuffer:
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], \ "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 1280x1024], "OMAP3 ISP CCDC":2 [SGRBG10 1280x1024], "OMAP3 ISP preview":1 [UYVY 1280x1024], "OMAP3 ISP resizer":1 [UYVY 1024x768]'
mplayer tv:// -tv driver=v4l2:device=/dev/video6:outfmt=uyvy:width=1024:height=768 -vo omapfb
TVP5151
Following set of commands will set up ISP pipeline to Sensor->CCDC->Memory and stream 720x524 video from TVP5151 decoder to OMAP framebuffer:
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
mplayer tv:// -tv driver=v4l2:device=/dev/video2:outfmt=uyvy:width=720:height=524 -vo omapfb -vf crop=720:480:0:44,pp=li
Snapshots
USB Camera
To take snapshots from USB Camera, run the MPlayer with the following command line:
mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -vf screenshot -vo omapfb
MT9T031
ISP Camera snapshoot from MT9T031 sensor could be obtained by the following set of commands:
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], \ "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 1280x1024], "OMAP3 ISP CCDC":2 [SGRBG10 1280x1024], \ "OMAP3 ISP preview":1 [UYVY 1280x1024], "OMAP3 ISP resizer":1 [UYVY 1024x768]'
mplayer tv:// -tv driver=v4l2:device=/dev/video6:outfmt=uyvy:width=1024:height=768 -vf screenshot -vo omapfb
TVP5151
ISP Camera snapshoot from TVP5151 decoder could be obtained by the following set of commands:
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
mplayer tv:// -tv driver=v4l2:device=/dev/video2:outfmt=uyvy:width=720:height=524 -vf crop=720:480:0:44,pp=li,screenshot -vo omapfb
Once there is an output streamed on the display, press s to take a snapshot. Each snapshot will be saved in your current directory as shotXXXX.png.
Playback
To play a movie, run the MPlayer with the following command line:
mplayer media_file.ogg -vo omapfb
GStreamer
GStreamer is a media-processing library that provides an abstract model of pipeline-based media flows in a defined direction from input to output. This article demonstrates streaming and encoding video from camera with and without hardware acceleration capabilities of CM-T3730. Please refer to Video Playback article to get an overview of GStreamer framework, validate instalation and hardware acceleration support. GStreamer package is included in the CM-T3730 Angstrom and Debian Linux root filesystem images.
Streaming to display
To start streaming the video to display the simple GStreamer pipeline can be used.
The basic GStreamer pipeline should have at least the source of the stream and the output sink specified.
The below examples stream the video from the V4L2 video capture device to the OMAP frame buffer (sink) with several stream manipulations applied.
USB Camera
Run the following command to stream the USB camera to display
gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,format=(fourcc)YUY2,width=640,height=480' ! videorate ! ffmpegcolorspace ! omapdmaifbsink
MT9T031
Run the following set of commands to stream video from MT9T031 sensor to display
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], \ "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 1280x1024], "OMAP3 ISP CCDC":2 [SGRBG10 1280x1024], "OMAP3 ISP preview":1 [UYVY 1280x1024], "OMAP3 ISP resizer":1 [UYVY 1024x768]'
gst-launch v4l2src device=/dev/video6 ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=1024,height=768' ! omapdmaifbsink
TVP5151
Run the following set of commands to stream video from TVP5151 decoder to display
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
gst-launch v4l2src device=/dev/video2 ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=720,height=524' ! videocrop top=44 ! deinterlace mode=1 fields=1 ! omapdmaifbsink
GStreamer pipeline parameters in details:
v4l2src | Element for reading frames from a Video4Linux2 device. | ||
|
Specify the V4L2 /dev/video0 device as a stream source. | ||
|
Disable copying of the stream buffers. This can slightly improve the GStreamer performance. | ||
video/x-raw-yuv,format=(fourcc)YUY2,width=640,height=480 | Link the source to a capability, which is defined by a mime type and a few optional properties. The properties are: video and resolution. | ||
videocrop | Crops video frames. | ||
|
Remove 44 pixels from the top of the image. | ||
deinterlace | Deinterlace the video. | ||
|
Force deinterlacing. | ||
|
Use top fields only for deinterlacing. | ||
videorate | Use each frame of the source stream and feed it to the next element at the requested framerate. | ||
ffmpegcolorspace | Make the color space conversion, required by the sink element. | ||
omapdmaifbsink | Define the OMAP frame buffer as the output sink. Sink can be: a file, screen or a network. For X Window System, the ximagesink parameter can be used. |
Streaming to a file
Hardware accelerated video encoding
This section demonstrates how to encode and save the output stream to a file, using the TI DMAI GStreamer plug-in.
USB Camera
Run the following command to save the USB Camera output stream to a file:
gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv, width=640,height=480, framerate=30/1' ! ffmpegcolorspace ! \ TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 framerate=30 ! filesink location=media_file.264
MT9T031
Run following set of commands to save the MT9T031 sensor output stream to a file:
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], \ "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 800x600], "OMAP3 ISP CCDC":2 [SGRBG10 800x600], \ "OMAP3 ISP preview":1 [UYVY 800x600], "OMAP3 ISP resizer":1 [UYVY 640x480]'
gst-launch v4l2src device=/dev/video6 ! queue ! TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 framerate=25 ! \ filesink location=media_file.264
TVP5151
Run following set of commands to save the TVP5151 decoder output stream to a file:
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
gst-launch v4l2src device=/dev/video2 always-copy=false ! videocrop top=44 ! deinterlace mode=1 fields=1 ! queue ! \ TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 framerate=25 ! filesink location=media_file.264
Software video encoding
This section demonstrates how to encode and save the output stream to a file, using the Theora codec with no hardware acceleration.
USB Camera
Run the following command to save the USB Camera output stream to a file:
gst-launch v4l2src ! 'video/x-raw-yuv,width=320,height=240' ! queue ! videorate ! 'video/x-raw-yuv,framerate=10/1' ! ffmpegcolorspace ! \ theoraenc ! queue ! oggmux ! filesink location=media_file.ogg
MT9T031
Run following set of commands to save the MT9T031 sensor output stream to a file:
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], \ "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 320x240], "OMAP3 ISP CCDC":2 [SGRBG10 320x240], "OMAP3 ISP preview":1 [UYVY 320x240], \ "OMAP3 ISP resizer":1 [UYVY 320x240]'
gst-launch v4l2src device=/dev/video6 ! 'video/x-raw-yuv, format=(fourcc)UYVY' ! queue ! videorate ! 'video/x-raw-yuv,framerate=10/1' ! \ queue ! ffmpegcolorspace ! theoraenc ! queue ! oggmux ! filesink location=media_file.ogg
TVP5151
Run following set of commands to save the TVP5151 decoder output stream to a file:
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
gst-launch v4l2src device=/dev/video2 ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=720,height=524' ! videocrop top=44 ! \ deinterlace mode=1 fields=1 ! videoscale ! 'video/x-raw-yuv,width=310,height=240' ! queue ! videorate ! \ 'video/x-raw-yuv,framerate=10/1' ! ffmpegcolorspace ! theoraenc ! queue ! oggmux ! filesink location=media_file.ogg
GStreamer parameters in details:
queue | Provides a buffer for the next element in the pipeline. | ||
theoraenc | Encodes raw video into theora stream. | ||
oggmux | Muxes a stream into an ogg container. | ||
videoscale | Resizes video frames. | ||
filesink | Writes the incoming data to a file. | ||
TIVidenc1 | Encodes video. | ||
|
Encode using H.264 codec. | ||
|
Specify codec server. | ||
|
Set encoding bitrate to 4000000 bit/s. | ||
|
Set encoding framerate to 25. |
Streaming to a file and display
Hardware accelerated video encoding
Folowing examples demonstrate hardware accelerated video encoding into AVI container with output to display.
USB Camera
gst-launch v4l2src device=/dev/video0 always-copy=false ! 'video/x-raw-yuv, width=640,height=480' ! ffmpegcolorspace ! tee name=t_video ! \ queue ! omapdmaifbsink t_video. ! queue ! TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 framerate=10 ! \ avimux ! filesink location=media_file.avi
MT9T031
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], \ "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 800x600], "OMAP3 ISP CCDC":2 [SGRBG10 800x600], "OMAP3 ISP preview":1 [UYVY 800x600], \ "OMAP3 ISP resizer":1 [UYVY 640x480]'
gst-launch v4l2src device=/dev/video6 ! tee name=t_video ! queue ! omapdmaifbsink t_video. ! queue ! \ TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 framerate=25 ! avimux ! filesink location=media_file.avi
TVP5151
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
gst-launch v4l2src device=/dev/video2 always-copy=false ! videocrop top=44 ! deinterlace mode=1 fields=1 ! tee name=t_video ! \ queue ! omapdmaifbsink t_video. ! queue ! TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 framerate=25 ! \ avimux ! filesink location=media_file.avi
Software video encoding
Folowing examples demonstrate software video encoding into OGG container with output to display.
USB Camera
Following command splits the source stream from USB Camera and links to the frame buffer and to an encoded file:
gst-launch v4l2src always-copy=false ! 'video/x-raw-yuv,width=320,height=240' ! tee name=t_video ! queue ! videorate ! ffmpegcolorspace ! \ omapdmaifbsink t_video. ! queue ! videorate ! 'video/x-raw-yuv,framerate=10/1' ! ffmpegcolorspace ! theoraenc ! \ queue ! oggmux ! filesink location=media_file.ogg
MT9T031
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], \ "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 640x480], "OMAP3 ISP CCDC":2 [SGRBG10 640x480], "OMAP3 ISP preview":1 [UYVY 640x480], "OMAP3 ISP resizer":1 [UYVY 320x240]'
gst-launch v4l2src device=/dev/video6 always-copy=false ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=320,height=240' ! tee name=t_video ! \ queue ! videorate ! ffmpegcolorspace ! omapdmaifbsink t_video. ! queue ! videorate ! 'video/x-raw-yuv,framerate=10/1' ! ffmpegcolorspace ! \ theoraenc ! queue ! oggmux ! filesink location=media_file.ogg
TVP5151
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
gst-launch v4l2src device=/dev/video2 always-copy=false ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=720,height=524' ! videocrop top=44 ! \ deinterlace mode=1 fields=1 ! videoscale ! 'video/x-raw-yuv, width=310,height=240' ! tee name=t_video ! queue ! omapdmaifbsink \ t_video. ! queue ! videorate ! 'video/x-raw-yuv,framerate=10/1' ! queue ! ffmpegcolorspace ! theoraenc ! queue ! oggmux ! \ filesink location=media_file.ogg
GStreamer parameters in detail:
avimux | Mux a stream into an avi container. | ||
tee | Split data to multiple streams (element pads). | ||
|
Name the element's pad. t_video is then linked to theora encoder. |
Streaming to a network and display
Folowing examples demonstrate hardware accelerated video encoding and network streaming with output to display.
Server
USB Camera
gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv, width=640,height=480' ! ffmpegcolorspace ! tee name=t_video ! \ queue ! omapdmaifbsink t_video. ! queue ! TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 ! \ rtph264pay pt=96 ! udpsink host=192.168.11.10 port=5000
MT9T031
media-ctl -r -l '"mt9t001 3-005d":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], \ "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -f '"mt9t001 3-005d":0 [SGRBG10 800x600], "OMAP3 ISP CCDC":2 [SGRBG10 800x600], "OMAP3 ISP preview":1 [UYVY 800x600], \ "OMAP3 ISP resizer":1 [UYVY 640x480]'
gst-launch v4l2src device=/dev/video6 ! tee name=t_video ! queue ! omapdmaifbsink t_video. ! queue ! \ TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 ! rtph264pay pt=96 ! udpsink host=192.168.11.10 port=5000
TVP5151
media-ctl -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"tvp5150 3-005c":0 [UYVY2X8 720x524], "OMAP3 ISP CCDC":0 [UYVY2X8 720x524]'
gst-launch v4l2src device=/dev/video2 always-copy=false ! videocrop top=44 ! deinterlace mode=1 fields=1 ! tee name=t_video ! \ queue ! omapdmaifbsink t_video. ! queue ! TIVidenc1 codecName=h264enc engineName=codecServer bitRate=4000000 ! \ rtph264pay pt=96 ! udpsink host=192.168.11.10 port=5000
Client
Desktop PC
gst-launch-0.10 udpsrc port=5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, \ payload=(int)96" ! rtph264depay ! ffdec_h264 ! xvimagesink
CM-T3730
gst-launch udpsrc port=5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, \ payload=(int)96" ! rtph264depay ! TIViddec2 ! omapdmaifbsink
GStreamer parameters in detail:
tee | Split data to multiple streams (element pads). | ||
|
Name the element's pad. t_video is then linked to theora encoder. | ||
rtph264pay | Payload-encode H264 video into RTP packets. | ||
|
Set RTP payload type to 96. | ||
rtph264depay | Extract H264 video from RTP packets. | ||
udpsink | Transfer data via UDP. | ||
|
Send the packets to 192.168.11.10 host only. Use this paramer to specify host/IP/Multicast group to send the packets to. | ||
|
Set the port to 5000. | ||
udpsrc | Receive data via UDP. | ||
|
Set the port to 5000. | ||
|
Give a type to the UDP packet. Launch gstreamer with -v parameter on the server side and copy the caps property from its output. |
File playback
Please refer to Video Playback article for playback examples.
See also
- Linux UVC driver and tools
- Camera ISP Driver
- MPlayer official resource
- GStreamer official resource
- GStreamer TI Plugin
- Ångström Distribution Feed browser
- CM-T3730: Linux: Getting started
- CM-T3730: Linux: Angstrom
- CM-T3730: Linux: Debian
- CM-T3730: Linux: Kernel
- CM-T3730: Linux: Angstrom - Digital Video SDK
- CM-T3730: Linux: Debian - Digital Video SDK
- CM-T3730: Linux: Video Playback
- Video Input Port Adapter Board
- Linux Development for ARM modules