Difference between revisions of "Using the i.MX27 video codec"

From ArmadeusWiki
Jump to: navigation, search
(Usage)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
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.
 
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 [[Talk:Using_the_i.MX27_video_codec|here]].
  
 
==Installation==
 
==Installation==
Line 10: Line 11:
 
{{Note|Currently, decoder/reader on the PC side has to be launched BEFORE the encoding tool on the APF27 (if using RTP stream)}}
 
{{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.
 
''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).
+
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:
 
<pre class="apf">
 
<pre class="apf">
 
# mxc_vpu_test.out -c codec.cfg.net.enc.vga.h264
 
# mxc_vpu_test.out -c codec.cfg.net.enc.vga.h264
 +
</pre>
 +
with the following ''codec.cfg.net.enc.vga.h264'' file:
 +
<pre>
 +
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;
 
</pre>
 
</pre>
  
Line 26: Line 48:
 
                   ! rtph264depay ! ffdec_h264 ! videoscale ! video/x-raw-yuv, width=320, height=240 ! xvimagesink sync=false
 
                   ! rtph264depay ! ffdec_h264 ! videoscale ! video/x-raw-yuv, width=320, height=240 ! xvimagesink sync=false
 
</pre>
 
</pre>
 +
 +
==Saving incoming streams on your PC==
 +
* Save an incoming H.264 RTP stream (port 6666) in a file:
 +
<pre class="host">
 +
$ 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
 +
</pre>
 +
 +
==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==
 
==Links==
Line 31: Line 66:
 
* [http://www.freescale.com/files/dsp/doc/app_note/AN3677.pdf?fpsp=1&WT_TYPE=Application%20Notes&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation  Freescale's Application Note 3677: Video Streaming on the i.MX27]
 
* [http://www.freescale.com/files/dsp/doc/app_note/AN3677.pdf?fpsp=1&WT_TYPE=Application%20Notes&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation  Freescale's Application Note 3677: Video Streaming on the i.MX27]
 
* [http://www.bitshrine.org/ Freescale's LTIB (Linux Target Image Builder)]
 
* [http://www.bitshrine.org/ Freescale's LTIB (Linux Target Image Builder)]
 +
 +
[[Category:Video]]
 +
[[Category:Vision]]

Latest revision as of 14:40, 23 January 2014

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