# BalenaOS 2.73.1+rev1 for RPI4: how to make bcm2835-codec working?

**URL:** <https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985>\
**Category:** balenaOS\
**Tags:** raspberrypi4\
**Created:** [April 12, 2021, 10:38am UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985 "2021-04-12T10:38:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fguerzoni](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fguerzoni](https://forums.balena.io/u/fguerzoni)\
**Post date:** [April 12, 2021, 10:38am UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/1 "2021-04-12T10:38:29Z")

</div>

Hi,  
my goal is to enable HEVC decoding on a RPI4 running Balena OS.  
I previously was able to make a patched FFMPEG work on the same RPI4 board with an Ubuntu 20.04 server for RPI4 distribution, following the instructions here: [https://github.com/jc-kynesim/rpi-ffmpeg/tree/dev/4.3.1%2Fdrm\_prime\_1](https://github.com/jc-kynesim/rpi-ffmpeg/tree/dev/4.3.1%2Fdrm_prime_1).

**With Balena OS**  
Now looking at dmesg (both with the prebuilt image and with the self made image) I notice the vc\_sm\_cma\_vchi\_init error and no /dev/videoX devices initialized:

> [15.638816] rpivid-mem feb00000.hevc-decoder: rpivid-hevcmem initialised: Registers at 0xfeb00000 length 0x00010000  
> [15.686483] rpivid-mem feb10000.rpivid-local-intc: rpivid-intcmem initialised: Registers at 0xfeb10000 length 0x00001000  
> [15.738116] mc: Linux media interface: v0.10  
> [15.739213] rpivid-mem feb20000.h264-decoder: rpivid-h264mem initialised: Registers at 0xfeb20000 length 0x00010000  
> [15.781821] rpivid-mem feb30000.vp9-decoder: rpivid-vp9mem initialised: Registers at 0xfeb30000 length 0x00010000  
> [15.810891] vc\_sm\_cma: module is from the staging directory, the quality is unknown, you have been warned.  
> [15.844259] bcm2835\_vc\_sm\_cma\_probe: Videocore shared memory driver  
> [15.864135] [vc\_sm\_connected\_init]: start  
> [15.883729] vc\_sm\_cma\_vchi\_init: failed to open VCHI service (-1)  
> [15.883739] [vc\_sm\_connected\_init]: failed to initialize shared memory service

**On Ubuntu 20.04 server** instead:

> ```
> 8.776970] rpivid-mem feb00000.hevc-decoder: rpivid-hevcmem initialised: Registers at 0xfeb00000 length 0x00010000
> 
> ```
> 
> [8.777171] rpivid-mem feb10000.rpivid-local-intc: rpivid-intcmem initialised: Registers at 0xfeb10000 length 0x00001000  
> [8.777339] rpivid-mem feb20000.h264-decoder: rpivid-h264mem initialised: Registers at 0xfeb20000 length 0x00010000  
> [8.777501] rpivid-mem feb30000.vp9-decoder: rpivid-vp9mem initialised: Registers at 0xfeb30000 length 0x00010000  
> [8.824418] vc\_sm\_cma: module is from the staging directory, the quality is unknown, you have been warned.  
> [8.825008] vc\_sm\_cma: module verification failed: signature and/or required key missing - tainting kernel  
> [8.826000] bcm2835\_vc\_sm\_cma\_probe: Videocore shared memory driver  
> [8.826009] [vc\_sm\_connected\_init]: start  
> [8.829893] [vc\_sm\_connected\_init]: installed successfully  
> …  
> [9.086728] bcm2835-codec bcm2835-codec: Device registered as /dev/video10  
> [9.086755] bcm2835-codec bcm2835-codec: Loaded V4L2 decode  
> [9.091218] bcm2835-codec bcm2835-codec: Device registered as /dev/video11  
> [9.091250] bcm2835-codec bcm2835-codec: Loaded V4L2 encode  
> [9.100934] bcm2835-codec bcm2835-codec: Device registered as /dev/video12  
> [9.100979] bcm2835-codec bcm2835-codec: Loaded V4L2 isp

I wonder what I need to flag on before the custom image build to enable the /dev/videoX devices.  
If only I had that then I would modify the config.txt and enable the /dev/video19 which is used for HEVC decode.

---

<div class="post-metadata">

**Author:** ![tmigone](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/tmigone/32/2814_2.png) [@tmigone](https://forums.balena.io/u/tmigone)\
**Post date:** [April 19, 2021, 4:41pm UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/7 "2021-04-19T16:41:03Z")

</div>

Hi there, a few questions to better understand your problem. Are you exposing the device (`/dev/videoX`) to the container? If you are using a multicontainer setup or a `docker-compose.yml` file it won’t be exposed by default. Typically you can expose all devices by adding the `privileged: true` flag to your container. Have you tried with this? You can read a bit more on this here: [Interact with hardware - Balena Documentation](https://www.balena.io/docs/learn/develop/hardware/)

---

<div class="post-metadata">

**Author:** ![tmigone](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/tmigone/32/2814_2.png) [@tmigone](https://forums.balena.io/u/tmigone)\
**Post date:** [April 19, 2021, 4:41pm UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/8 "2021-04-19T16:41:56Z")

</div>

Are the dmesg logs you shared from a container or from the hostOS?

---

<div class="post-metadata">

**Author:** ![fguerzoni](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fguerzoni](https://forums.balena.io/u/fguerzoni)\
**Post date:** [April 20, 2021, 8:25am UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/11 "2021-04-20T08:25:50Z")

</div>

Thank you for the reply Tomas.  
The dmesg is from hostOS, the devices are not visible to the host.

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [April 20, 2021, 3:50pm UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/12 "2021-04-20T15:50:30Z")

</div>

Hey @fguerzoni, I’ve seen this error when the GPU mem is too low.  
Note that in balenaOS the default GPU mem is 16M but to perform GPU actions you can increase that to 64M by setting the device config variable `BALENA_HOST_CONFIG_gpu_mem`.

> **[Advanced boot settings - Balena Documentation](https://www.balena.io/docs/reference/OS/advanced/)**

I hope this helps!

---

<div class="post-metadata">

**Author:** ![fguerzoni](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fguerzoni](https://forums.balena.io/u/fguerzoni)\
**Post date:** [April 21, 2021, 9:30am UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/14 "2021-04-21T09:30:53Z")

</div>

I tried and it works!  
Many many thanks

---

<div class="post-metadata">

**Author:** ![rapha](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/rapha/32/1239_2.png) [@rapha](https://forums.balena.io/u/rapha)\
**Post date:** [May 19, 2021, 7:25am UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/16 "2021-05-19T07:25:35Z")

</div>

Fixed it for me as well.

@klutchell Would you expect any performance benefit from assigning even more RAM to the GPU for encoding applications?

---

<div class="post-metadata">

**Author:** ![mtoman](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mtoman/32/3599_2.png) [@mtoman](https://forums.balena.io/u/mtoman)\
**Post date:** [May 19, 2021, 11:15am UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/17 "2021-05-19T11:15:54Z")

</div>

Hi @rapha, increasing the GPU memory may be necessary for higher resolution videos (up to 320M for 4K videos) but adding more GPU memory than necessary will have no effect on encoding/decoding performance.

---

<div class="post-metadata">

**Author:** ![ngmartins\_FF](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@ngmartins\_FF](https://forums.balena.io/u/ngmartins_FF)\
**Post date:** [April 14, 2022, 5:23pm UTC](https://forums.balena.io/t/balenaos-2-73-1-rev1-for-rpi4-how-to-make-bcm2835-codec-working/289985/19 "2022-04-14T17:23:58Z")

</div>

Hello all…

Something I am trying to realize from the Advanced boot settings configuration but it is not clear to me:

```auto
BALENA_HOST_CONFIG_gpu_mem

```

and other configs are just effective on Raspberry Pi?  
What about intel NUC? does it takes effect?

Thanks in advance,

Nuno
