Skip to content

H264 encoder in P4 interprets bitrate as bytes per second instead of bits per second (AEGHB-1265) #47

@sjaramillo-yx

Description

@sjaramillo-yx

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

The expected behavior is that if I set a bitrate of 6000000, at 1080p@30FPS, I should get around 0.1bpp using the formula 1920 * 1080 * bpp * 30 = 6000000

Actual behavior (suspected bug)

Actual behavior is that the largest buffers that I get from the encoder are 196608 bytes in size, which correspond to 5909760 bytes per second (196608 * 8 / (1920 * 1080) = 0.76), so a bitrate of 47278080 bps (8 times the target of 6 Mbps).

Error logs or terminal output

Steps to reproduce the behavior

  1. Configure bitrate using V4L2_CID_MPEG_VIDEO_BITRATE to 6000000
  2. Begin streaming at 1080p@30FPS using the HW encoder of ESP32-P4
  3. Cover the sensor to obtain the largest buffer possible (noisy image = higher bitrate)
  4. Check dequeued buffer size using the bytes_used member of the buffer, will be around 196608 bytes

Project release version

latest

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Linux

Operating system version

Debian 12

Shell

Bash

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions