This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
products:sbc:vim4:applications:hardware-encoding [2022/06/30 02:30] nick created |
products:sbc:vim4:applications:hardware-encoding [2024/04/21 21:36] (current) nick [Library Source Code] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Hardware Encoding ====== | + | ~~tag> |
+ | ====== | ||
+ | |||
+ | ===== Introduction ===== | ||
+ | |||
+ | This page introduces how to use hardware encoding on VIM4. | ||
+ | |||
+ | |||
+ | <WRAP important > | ||
+ | Only supoport Amlgoic 5.4/5.15 Kernel. | ||
+ | </ | ||
+ | |||
+ | ===== Encoding with Amlogic Library ===== | ||
+ | |||
+ | |||
+ | ==== H264 Hardware Encoding ==== | ||
+ | |||
+ | <tabbox VIM4> | ||
+ | |||
+ | ```shell | ||
+ | aml_enc_test 1080p.nv12 dump.h264 1920 1080 30 30 6000000 100 1 0 2 4 | ||
+ | ``` | ||
+ | |||
+ | <tabbox VIM3/ | ||
+ | |||
+ | ```shell | ||
+ | amvenc_test 1080p.nv12 dump.h264 1920 1080 30 30 6000000 100 1 0 2 4 | ||
+ | ``` | ||
+ | </ | ||
+ | |||
+ | |||
+ | The encoded file is '' | ||
+ | |||
+ | ==== H265 Hardware Encoding ==== | ||
+ | |||
+ | |||
+ | |||
+ | <tabbox VIM4> | ||
+ | |||
+ | ```shell | ||
+ | aml_enc_test 1080p.nv12 dump.h265 1920 1080 30 30 6000000 100 1 0 2 5 | ||
+ | ``` | ||
+ | |||
+ | <tabbox VIM3/ | ||
+ | |||
+ | ```shell | ||
+ | amvenc_test 1080p.nv12 dump.h265 1920 1080 30 30 6000000 100 1 0 2 5 | ||
+ | ``` | ||
+ | </ | ||
+ | |||
+ | |||
+ | The encoded file is '' | ||
+ | |||
+ | ==== JPEG Hardware Encoding ==== | ||
+ | |||
+ | |||
+ | ```shell | ||
+ | jpeg_enc_test 1080p.nv12 dump.jpg 1920 1080 100 3 0 8 8 0 | ||
+ | ``` | ||
+ | |||
+ | The encoded file is '' | ||
+ | |||
+ | ===== Encoding with Gstreamer ===== | ||
+ | |||
+ | ==== Install Gstreamer Encoder Plugins ==== | ||
+ | |||
+ | You need to install the gstreamer encoder plugins: | ||
+ | |||
+ | ```shell | ||
+ | sudo apt update | ||
+ | sudo apt install gstreamer-aml | ||
+ | ``` | ||
+ | |||
+ | Check the gstreamer encoder plugins: | ||
+ | |||
+ | ```shell | ||
+ | $ gst-inspect-1.0 | grep aml | ||
+ | amljpegenc: | ||
+ | amlvenc: | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ==== H264 Hardware Encoding | ||
+ | |||
+ | Here is an example to decode H264 file to NV12 and then encode to H264. | ||
+ | |||
+ | Decoding & encoding: | ||
+ | |||
+ | ```shell | ||
+ | gst-launch-1.0 filesrc location=/ | ||
+ | ``` | ||
+ | |||
+ | Another example to decode video from USB camera and encode to H264: | ||
+ | |||
+ | ```shell | ||
+ | gst-launch-1.0 v4l2src device=/ | ||
+ | ``` | ||
+ | |||
+ | ==== H265 Hardware Encoding | ||
+ | |||
+ | Here is an example to decode H264 file to NV12 and then encode to H265. | ||
+ | |||
+ | Decoding & encoding: | ||
+ | |||
+ | |||
+ | ```shell | ||
+ | gst-launch-1.0 filesrc location=/ | ||
+ | ``` | ||
+ | |||
+ | Another example to decode video from USB camera and encode to H265: | ||
+ | |||
+ | ```shell | ||
+ | gst-launch-1.0 v4l2src device=/ | ||
+ | ``` | ||
+ | |||
+ | ==== JPEG Hardware Encoding | ||
+ | |||
+ | Read one frame YUY2 format data from USB camera and encode to jpeg file. | ||
+ | |||
+ | ```shell | ||
+ | gst-launch-1.0 -v v4l2src device=/ | ||
+ | ``` | ||
+ | |||
+ | ===== Library Source Code ===== | ||
+ | |||
+ | * VIM4 H264/H265 [[gh> | ||
+ | * VIM3/3L [[gh> | ||
+ | * JPEG [[gh> | ||