VIM3 H.264/H.265 video encoding

Is there any documentation on VIM3’s HW-accelerated video encoding? I’m on Ubuntu built with Fenix and get the following error when trying to run a simple pipeline:

khadas@Khadas:~$ uname -a
Linux Khadas 4.9.206 #4 SMP PREEMPT Tue Feb 25 16:30:33 GMT 2020 aarch64 aarch64 aarch64 GNU/Linux
khadas@Khadas:~$ gst-launch-1.0 videotestsrc ! amlvenc  ! fakesink -ve
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

(gst-launch-1.0:6848): GStreamer-CRITICAL **: 12:46:21.939: gst_mini_object_unref: assertion 'mini_object != NULL' failed

(gst-launch-1.0:6848): GStreamer-CRITICAL **: 12:46:21.939: gst_mini_object_ref: assertion 'mini_object != NULL' failed
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
ERROR:gstamlvenc.c:631:gst_amlvenc_init_encoder: assertion failed: (encoder->vtable != NULL)

Can you help?

Additionally, where can I find the source code for the HW encoding driver and GStreamer plugins?

Anyone? I can’t find the source and Fenix builds from a blob in @numbqq’s GitHub repo ( Is VIM3 closed source?

Can someone answer this please? I’m considering the board for a large commercial application and this is a blocker.

Hello @coudy

I will check this issue this week.

Thanks, @numbqq. Have you had any luck?

Still not, but I think this topic maybe will help you

The API on the kernel side for the encoder is different from what you have on the driver. That’s why the same encoder does not work on A311D. You may not need to update the kernel module for the encoder, but I found that it may work incorrectly sometime. DMA buffer seems to be incoherent…

We are also using gstreamer for our application as well, unfortunately, I don’t have the gstreamer_aml code. For us, we read data from camera and pipe to the encoder then send the encoded image to gstreamer for further use ( streaming/saving to file). In the end, we are happier than just using gstreamer because we can open multiple channels on the cameras, and allows us much greater control (we get main camera, additional information, and a down sampling all from V4L2)

Hello @pitchaya

I will work more on this next week, And I can share the source code to you if you want.

If you shared me the code, I can try to fix it.

Hello @pitchaya

Here is the source code of buildroot. We build gstreamer from it.

1 Like

Thanks. Is it feasible to transcode a live 1080p MJPEG stream to H.264/5 at 30fps?

Hey @coudy, I see a gstreamer command in your post. Can you please tell me, that you were using a MIPI-CSI camera from khadas or a USB cam? also from where did you got this command:
gst-launch-1.0 videotestsrc ! amlvenc ! fakesink -ve
Is there any docs present for it. I want to use gstreamer for my VIM3+MIPI-CSI khadas camera. Can you help me? I’ll use this gstreamer command with cv2.VideoCapture in python


Hi! The buildroot link doesn’t seem to be working any more, is there any chance you could re-upload it somewhere?

the great daveshah! hi! :slight_smile:
i want hw accel h265 encoding also!
ffmpeg encoding to 960x540 runs about 2.0 fps on vim3.

request re-upload for sources to amlogic hw encoder
[edit] ah well i have encoder.c and it looks 264 only
sorry. ignore me.

Hi @coudy!

Can you tell me please, did you get some results of h264/265 encoding on khadas VIM3?
And could you provide some advices to make it realtime?

Best regards,