This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
products:sbc:vim4:applications:hardware-encoding [2022/10/25 23:52] nick |
products:sbc:vim4:applications:hardware-encoding [2024/04/19 04:15] nick [H265 Hardware Encoding] |
||
---|---|---|---|
Line 8: | Line 8: | ||
<WRAP important > | <WRAP important > | ||
- | Only supoport Amlgoic 5.4 Kernel. | + | Only supoport Amlgoic 5.4/5.15 Kernel. |
</ | </ | ||
Line 15: | Line 15: | ||
==== H264 Hardware Encoding ==== | ==== H264 Hardware Encoding ==== | ||
+ | |||
+ | <tabbox VIM4> | ||
```shell | ```shell | ||
aml_enc_test 1080p.nv12 dump.h264 1920 1080 30 30 6000000 100 1 0 2 4 | aml_enc_test 1080p.nv12 dump.h264 1920 1080 30 30 6000000 100 1 0 2 4 | ||
``` | ``` | ||
+ | |||
+ | <tabbox VIM3/3L> | ||
+ | |||
+ | ```shell | ||
+ | amvenc_test 1080p.nv12 dump.h264 1920 1080 30 30 6000000 100 1 0 2 4 | ||
+ | ``` | ||
+ | </ | ||
+ | |||
The encoded file is '' | The encoded file is '' | ||
==== H265 Hardware Encoding ==== | ==== H265 Hardware Encoding ==== | ||
+ | |||
+ | |||
+ | |||
+ | <tabbox VIM4> | ||
```shell | ```shell | ||
aml_enc_test 1080p.nv12 dump.h265 1920 1080 30 30 6000000 100 1 0 2 5 | aml_enc_test 1080p.nv12 dump.h265 1920 1080 30 30 6000000 100 1 0 2 5 | ||
``` | ``` | ||
+ | |||
+ | <tabbox VIM3/3L> | ||
+ | |||
+ | ```shell | ||
+ | amvenc_test 1080p.nv12 dump.h265 1920 1080 30 30 6000000 100 1 0 2 5 | ||
+ | ``` | ||
+ | </ | ||
+ | |||
The encoded file is '' | The encoded file is '' | ||
Line 34: | Line 56: | ||
```shell | ```shell | ||
- | jpeg_enc_test 1080p.nv12 dump.jpg 1920 1080 100 3 0 16 16 0 | + | jpeg_enc_test 1080p.nv12 dump.jpg 1920 1080 100 3 0 8 8 0 |
``` | ``` | ||
Line 54: | Line 76: | ||
```shell | ```shell | ||
$ gst-inspect-1.0 | grep aml | $ gst-inspect-1.0 | grep aml | ||
- | amlvenc: | + | amljpegenc: |
- | ``` | + | amlvenc: |
- | '' | + | * '' |
+ | * '' | ||
==== H264 Hardware Encoding | ==== H264 Hardware Encoding | ||
Here is an example to decode H264 file to NV12 and then encode to H264. | Here is an example to decode H264 file to NV12 and then encode to H264. | ||
- | |||
- | As we also need to use the hardware decoder, so we need to setup parameters for it first. | ||
- | |||
- | ```shell | ||
- | echo 1 | sudo tee / | ||
- | echo 1 | sudo tee / | ||
- | echo 0 | sudo tee / | ||
- | ``` | ||
Decoding & encoding: | Decoding & encoding: | ||
```shell | ```shell | ||
- | gst-launch-1.0 filesrc location=/ | + | gst-launch-1.0 filesrc location=/ |
``` | ``` | ||
Line 80: | Line 95: | ||
```shell | ```shell | ||
- | gst-launch-1.0 v4l2src device=/ | + | gst-launch-1.0 v4l2src device=/ |
- | ``` | + | |
- | + | ||
- | Or mux to mp4 file: | + | |
- | + | ||
- | ```shell | + | |
- | gst-launch-1.0 v4l2src device=/ | + | |
``` | ``` | ||
==== H265 Hardware Encoding | ==== H265 Hardware Encoding | ||
- | Here is an example to decode H264 file to NV12 and then encode to H264. | + | Here is an example to decode H264 file to NV12 and then encode to H265. |
- | + | ||
- | As we also need to use the hardware decoder, so we need to setup parameters for it first. | + | |
- | + | ||
- | ```shell | + | |
- | echo 1 | sudo tee / | + | |
- | echo 1 | sudo tee / | + | |
- | echo 0 | sudo tee / | + | |
- | ``` | + | |
Decoding & encoding: | Decoding & encoding: | ||
Line 105: | Line 106: | ||
```shell | ```shell | ||
- | gst-launch-1.0 filesrc location=/ | + | gst-launch-1.0 filesrc location=/ |
``` | ``` | ||
Line 111: | Line 112: | ||
```shell | ```shell | ||
- | gst-launch-1.0 v4l2src device=/ | + | gst-launch-1.0 v4l2src device=/ |
``` | ``` | ||
- | Or mux to mp4 file: | + | ==== JPEG Hardware Encoding |
+ | |||
+ | Read one frame YUY2 format data from USB camera and encode | ||
```shell | ```shell | ||
- | gst-launch-1.0 v4l2src device=/ | + | gst-launch-1.0 |
``` | ``` | ||
- | ==== JPEG Hardware Encoding | + | ===== Library Source Code ===== |
- | + | ||
- | WIP: | + | |
+ | * H264/H265 [[gh> | ||
+ | * JPEG [[gh> | ||