Using the i.MX27 video codec

From ArmadeusWiki
Revision as of 14:40, 23 January 2014 by JulienB (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The i.MX27 (used on the APF27) has an internal DSP which can be used to encode/decode video stream, coming from various sources (CSI, buffer, etc...). To use it Freescale provides some useful tools. For VPU usage on recent Linux kernels, instructions are being built here.

Installation

$ make freescale-tools
  • then reflash your rootfs and you will get some stuff in /usr/bin/vpu/

Usage

Note Note: Currently, decoder/reader on the PC side has to be launched BEFORE the encoding tool on the APF27 (if using RTP stream)

mxc_vpu_test.out (yeah Freescale has strange ways to name its executables ;-) ) allows you to decode/encode video streams. This tool needs a configuration file (some are given as examples).

  • To encode video in H.264 and send it through Ethernet/RTP to a client with 192.168.0.17 IP:
# mxc_vpu_test.out -c codec.cfg.net.enc.vga.h264

with the following codec.cfg.net.enc.vga.h264 file:

 1       ; Number of Codec
 0       ; index
 1       ; src, 0 file, 1 camera, 2 network
 /root/Kaleidoscope_h264_aac.m4v    ;file name or IP, if src is camera, ignore this item.
 2       ; dst, 0 file, 1 LCD, 2 network
 192.168.0.17    ; act as server
 1       ; 0=Dec, 1=Enc
 25      ; fps in Hz, not used now
 0       ; bitrate in Kbps (64, 128, 384), 0=auto
 2       ; 0=Mpeg4, 1=H.263, 2=H.264
 640     ; picWidth
 480     ; picHeight
 1       ; GopSize (0 only first frame is I, 1 all is I; 2: IPIP...), not used now
 1200    ; frame_count, not used now
 0       ; rot_angle;
 1       ; out_ratio, to fit the screen 240*320
 0       ; mirror, 0 none, 1 horizon, 2 vertical;

Decoding incoming streams on your PC

  • Decoding an RTP H.264 stream coming in UDP on port 6666 and displaying it at original size:
$ gst-launch-0.10 udpsrc port=6666 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" \
                  ! rtph264depay ! ffdec_h264 ! xvimagesink sync=false
  • Decoding an RTP H.264 stream coming in UDP on port 6666 and displaying it in 320x240:
$ gst-launch-0.10 udpsrc port=6666 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" \
                  ! rtph264depay ! ffdec_h264 ! videoscale ! video/x-raw-yuv, width=320, height=240 ! xvimagesink sync=false

Saving incoming streams on your PC

  • Save an incoming H.264 RTP stream (port 6666) in a file:
 $ gst-launch-0.10 udpsrc port=6666 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" \
                   ! rtph264depay ! filesink location=./gst-test.264

Debugging incoming streams

  • Activate debug (level 5) in rtph264depay module:
$ gst-launch-0.10 --gst-debug=rtph264depay:5 ...
  • Activate debug (all modules):
$ gst-launch-0.10 --gst-debug-level=5 ...

Links