| 1 | [[PageOutline]] |
| 2 | |
| 3 | [=#video] |
| 4 | = Video = |
| 5 | The following pipeline examples utilize plugins from the the Freescale gst-fsl-plugin package on GStreamer 0.10. |
| 6 | |
| 7 | gst-fsl-plugin elements used: |
| 8 | * Output: |
| 9 | * '''mfw_v4lsink''' - stretch and render video frames to a V4L output device using hardware acceleration via the IMX6 IPU. |
| 10 | * Input: |
| 11 | * '''mfw_v4lsrc''' - capture video utilizing hardware acceleration via the IMX6 IPU. |
| 12 | * '''tvsrc''' - capture video from an interlaced source utilizing hardware acceleration via the IMX6 IPU to capture and de-interlace. |
| 13 | * Encode / Decode: |
| 14 | * '''vpuenc''' - encode video using the specified code utilizing hardware acceleration via the IMX6 VPU. |
| 15 | * '''vpudec''' - decode video utilizing hardware acceleration via the IMX6 VPU. |
| 16 | |
| 17 | For a description of Video devices see: |
| 18 | * [wiki:Yocto/Video_In Video Input Devices] |
| 19 | * [wiki:Yocto/Video_Out Video Output Devices] |
| 20 | |
| 21 | References: |
| 22 | * [https://community.freescale.com/docs/DOC-93446 Here] are more examples. |
| 23 | * [https://community.freescale.com/docs/DOC-93387/version/4 Freescale Site Examples] |
| 24 | |
| 25 | |
| 26 | [=#video-output] |
| 27 | == Output == |
| 28 | For boards that support video out, the following pipeline will generate a video test pattern and output it to the first video device using [[wiki:Video_Out|v4l]]: |
| 29 | {{{ |
| 30 | gst-launch videotestsrc pattern=18 ! mfw_v4lsink device=/dev/video16 |
| 31 | }}} |
| 32 | |
| 33 | |
| 34 | [=#video-capture] |
| 35 | == Input == |
| 36 | We can even take video from an external source and stream it to a display |
| 37 | {{{ |
| 38 | gst-launch mfw_v4lsrc device=/dev/video0 ! mfw_v4lsink device=/dev/video16 |
| 39 | }}} |
| 40 | * tvsrc is used for interlaced video input such as Ventana Analog video In |
| 41 | * mfw_v4lsrc is used for non-interlaced video input such as HDMI video In available on the GW54xx and GW551x |
| 42 | |
| 43 | |
| 44 | [=#video-encoding] |
| 45 | == Encoding == |
| 46 | Here is a simple example that encodes a test pattern (pattern 18 is a bouncing ball) to MJPEG and stored to a file with an AVI container. |
| 47 | {{{ |
| 48 | gst-launch videotestsrc pattern=18 num-buffers=512 ! vpuenc codec=mjpg ! \ |
| 49 | avimux ! filesink location=/tmp/test.avi |
| 50 | }}} |
| 51 | |
| 52 | |
| 53 | [=#video-decoding] |
| 54 | == Decoding == |
| 55 | We can decode the video from an avi using vpudec which utilizes hardware decoding from the VPU: |
| 56 | {{{ |
| 57 | gst-launch filesrc location=/media/sda1/big_buck_bunny_720p_surround.avi ! \ |
| 58 | avidemux ! vpudec ! mfw_v4lsink device=/dev/video16 |
| 59 | }}} |
| 60 | |
| 61 | |
| 62 | [=#video-transcode] |
| 63 | == Transcoding == |
| 64 | We can transcode a file from an avi bin and encode to the H.263 standard |
| 65 | {{{ |
| 66 | gst-launch filesrc location=/media/sda1/big_buck_bunny_720p_surround.avi ! \ |
| 67 | avidemux ! vpudec ! vpuenc codec=h263 ! filesink location=/tmp/test.mov |
| 68 | }}} |
| 69 | |
| 70 | References: |
| 71 | * [https://community.freescale.com/docs/DOC-93448 IMX Community DOC-93448] |
| 72 | |
| 73 | |
| 74 | [=#video-loopback] |
| 75 | == Video loopback (Useful for testing video input and output) == |
| 76 | A simple video loopback test can take video input and output it to the HDMI output as shown in the example below from a GW5400: |
| 77 | |
| 78 | Digital HDMI Video Input to HDMI Video Output: |
| 79 | {{{ |
| 80 | gst-launch mfw_v4lsrc device=/dev/video0 ! mfw_v4lsink device=/dev/video16 |
| 81 | }}} |
| 82 | * Note: For certain resolutions / modes tvsrc may work for HDMI input but typically should not be used. |
| 83 | |
| 84 | Analog Video Input to HDMI Video Output: |
| 85 | {{{ |
| 86 | gst-launch -v tvsrc device=/dev/video1 ! mfw_v4lsink device=/dev/video16 |
| 87 | }}} |
| 88 | * Note that the GW54xx has digital HDMI input as well which is /dev/video0. Boards with analog video input only will present it on /dev/video0 |
| 89 | |
| 90 | We also invite you to look at [https://raw.githubusercontent.com/Gateworks/meta-gateworks/dizzy/recipes-support/gateworks-test/gateworks-test/test_video this script] for similar use cases and examples. This script is what we use to test video input and output capabilities. |