Jump to content

RaspPi 4 (64-bit Docker)-Hardware transcoding detection fails although FFmpeg can successfully use h264_v4l2m2


Recommended Posts

lugaidvii
Posted

# Raspberry Pi 4 (ARM64 Docker) - Hardware transcoding detection fails although FFmpeg successfully uses h264_v4l2m2m

## Environment

### Emby Version

4.9.3.0

### Container

Official Emby ARM64 Docker container

### Host OS

Ubuntu 24.04.4 LTS

Kernel:

```text
Linux 6.12.87+rpt-rpi-v8
```

### Hardware

```text
Raspberry Pi 4
ARM64
4-core Cortex-A72
```

---

## Problem

Emby does not detect any hardware video encoders or decoders.

The Hardware Detection log only reports software codecs:

```json
"VideoDecoders": {},

"VideoEncoders": {
  "x264": {...},
  "x265": {...}
}
```

As a result, Emby always transcodes using:

```text
libx264
```

instead of Raspberry Pi hardware encoding through:

```text
h264_v4l2m2m
```

However, manual tests performed inside the exact same container successfully use the Raspberry Pi hardware encoder.

---

## Hardware Devices Visible Inside Container

### Video Devices

```bash
ls -l /dev/video*
```

Output:

```text
crw-rw---- 1 root 44 81,2   /dev/video10
crw-rw---- 1 root 44 81,4   /dev/video11
crw-rw---- 1 root 44 81,9   /dev/video12
crw-rw---- 1 root 44 81,1   /dev/video13
crw-rw---- 1 root 44 81,3   /dev/video14
crw-rw---- 1 root 44 81,5   /dev/video15
crw-rw---- 1 root 44 81,6   /dev/video16
crw-rw---- 1 root 44 81,12  /dev/video18
crw-rw---- 1 root 44 81,0   /dev/video19
crw-rw---- 1 root 44 81,7   /dev/video20
crw-rw---- 1 root 44 81,8   /dev/video21
crw-rw---- 1 root 44 81,10  /dev/video22
crw-rw---- 1 root 44 81,11  /dev/video23
crw-rw---- 1 root 44 81,13  /dev/video31
```

### DRM Devices

```bash
ls -l /dev/dri
```

Output:

```text
card0
card1
renderD128
```

### Permissions

```bash
id
```

Output:

```text
uid=0(root)
gid=0(root)
groups=0(root),10(wheel),28(video)
```

---

## Manual FFmpeg Test #1

Executed inside the Emby container using Emby's bundled FFmpeg:

```bash
/bin/ffmpeg \
-i "/mnt/multimedia/series/Series/The Big Bang Theory/Season 2/The Big Bang Theory - s02e05.mkv" \
-c:v h264_v4l2m2m \
-f null -
```

Relevant output:

```text
[h264_v4l2m2m @ 0x19a68b70] Using device /dev/video11
[h264_v4l2m2m @ 0x19a68b70] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode
[h264_v4l2m2m @ 0x19a68b70] requesting formats: output=YU12 capture=H264
```

Transcoding proceeds successfully.

---

## Manual FFmpeg Test #2

Synthetic source test:

```bash
/bin/ffmpeg \
-f lavfi \
-i testsrc=size=1280x720:rate=30 \
-t 20 \
-c:v h264_v4l2m2m \
-f null -
```

Relevant output:

```text
[h264_v4l2m2m @ 0x24c8f020] Using device /dev/video11
[h264_v4l2m2m @ 0x24c8f020] driver 'bcm2835-codec' on card 'bcm2835-codec-encode'
```

Encoding completes successfully.

---

## Hardware Detection Results

The generated `hardware_detection-*.txt` files show:

```json
"VideoDecoders": {}
```

and only software encoders:

```json
"VideoEncoders": {
  "x264": {
    "IsHardwareCodec": false
  },
  "x265": {
    "IsHardwareCodec": false
  }
}
```

No V4L2M2M encoders or decoders are detected.

---

## Actual FFmpeg Command Used By Emby

While playing content that requires transcoding:

```bash
ps auxww | grep ffmpeg
```

shows:

```bash
/bin/ffmpeg \
...
-c:v:0 libx264
...
```

Full relevant section:

```bash
-map [f1_out0]
-c:v:0 libx264
-preset:v:0 veryfast
-profile:v:0 high
-crf:v:0 23
```

Emby never attempts to use:

```text
h264_v4l2m2m
```

even though the encoder works when manually invoked.

---

## Additional Observation

An attempt to use DRM hardware acceleration:

```bash
/bin/ffmpeg \
-hwaccel drm \
-i input.mkv \
-c:v h264_v4l2m2m \
-f null -
```

fails with:

```text
Device creation failed: -14
No device available for decoder: device type drm needed for codec h264
```

However, encoding works correctly when using V4L2M2M directly without DRM hardware decoding.

This suggests the encoder itself is functional and accessible.

---

## Expected Behavior

Emby should detect Raspberry Pi V4L2M2M hardware codecs and offer/use hardware transcoding.

---

## Actual Behavior

Hardware detection reports only software codecs and all transcoding falls back to libx264.

---

## Question

Is Raspberry Pi 4 hardware transcoding through V4L2M2M expected to be supported in Emby Server 4.9.x on ARM64 Docker?

If so:

1. Is there a way to force hardware codec detection?
2. Is additional logging available for the Hardware Detection process?
3. Is V4L2M2M currently supported by Hardware Detection on Raspberry Pi OS / Ubuntu ARM64?

Thank you.

hardware_detection-63916570464.txt

Posted

Hello lugaidvii,

** This is an auto reply **

Please wait for someone from staff support or our members to reply to you.

It's recommended to provide more info, as it explain in this thread:


Thank you.

Emby Team

TMCsw
Posted

My best advice would be not to use an RPI4 if you need to transcode, as it really can't do much more than 1 or 2 HD (mpeg4-1080I;/720p) conversions.(It works great if you can directly play)

But you can try:

  • Add Emby (or whoever the Emby user is) to the render group  'sudo adduser emby render'
  • I don't use Docker, but I know you need to set it to use the H/W, so post your Docker Compose here, maybe someone else can help you.

I've long since given up on this (Pi4) hardware for transcoding.

  • 2 weeks later...
Posted

@lugaidvii

HI, have you updated to Emby Server 4.9.5? Has that helped?

lugaidvii
Posted

hi, yes I already update to latest version but still the same, it seems to be an issue with hardware detector on raspberry 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...