IMX8MPLUS
Platform Details:
Use Case:
We are building a dynamic multi-stream video pipeline using GStreamer with the following architecture:
v4l2src → capsfilter → imxvideoconvert_g2d → tee
├── RTSP branch (v4l2h264enc)
We dynamically create/remove encoder branches from a tee (using request pads) and support runtime configuration updates via API.
Problem Description:
We are attempting to dynamically update encoder parameters at runtime (pipeline in PLAYING state), specifically:
Bitrate mode (CBR / VBR)
Bitrate
Resolution (caps change)
This is done using:
g_object_set() on encoder (extra-controls)
Updating caps on downstream capsfilter
Updating videorate (max-rate)
Relevant Code (Simplified):
enc_el.set_property("extra-controls", Gst.Structure.new_from_string(
"controls,video_bitrate_mode=1,video_gop_size=25"))
rate_el.set_property("max-rate", fps)
res_el.set_property("caps", Gst.Caps.from_string(
f"video/x-raw,width={w},height={h},format=BGRx"))
Observed Behavior:
Immediately after applying dynamic update (especially bitrate mode change), pipeline fails with:
gstvideoencoder.c:2506:
Can't copy metadata because input frame disappeared
v4l2object.c:6524: gst_v4l2_object_poll:
poll error 1: Invalid argument (22)
GST_ERROR:
Could not read from resource.
gstbasesrc.c:3187:
Internal data stream error.
streaming stopped, reason error (-5)
This results in:
Encoder failure (v4l2h264enc)
Queue failure
Source (v4l2src) stopping
Entire pipeline going to error state
Full Error Logs (Excerpt):
gst_v4l2_object_poll:<v4l2h264enc> error: poll error 1: Invalid argument (22)
gst_element_message_full_with_details: Could not read from resource
gst_base_src_loop:<v4l2src> error: Internal data stream error
streaming stopped, reason error (-5)
Key Observations:
Issue is reproducible when changing:
Sometimes encoder accepts property but:
no visible effect OR
fails shortly after
FPS changes using videorate work fine
Resolution changes sometimes work but are unstable
Questions:
Is runtime update of v4l2h264enc controls supported?
Specifically:
video_bitrate_mode
video_bitrate
video_gop_size
Are these controls required to be set only in:
Does the i.MX8MP VPU driver support:
For resolution change:
What is the recommended approach for:
Additional Context:
In commercial IP cameras, bitrate appears to change dynamically without stream interruption.
We would like to understand whether:
Expected Guidance:
Official recommendation from NXP for runtime encoder reconfiguration
Supported vs unsupported controls in PLAYING state
Best practice for dynamic streaming pipelines
Summary:
Dynamic updates to v4l2h264enc (especially bitrate mode) result in:
We want to confirm whether this is expected behavior and how to correctly implement dynamic reconfiguration.
Thank you.