This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VE-Q1: J721S2 Encoder bitrate setting

Part Number: TDA4VE-Q1
Other Parts Discussed in Thread: TEST2

Tool/software:

According this 

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1282498/tda4ve-q1-how-to-set-encoder-bitrate

We use J721S2 and SDK8.4

We use the patch and test encoder bitrate setting again.

https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/?h=ti-linux-6.1.y-cicd&id=12598d7a3ca52f5166b67cc714329029b4502543

But result still fail, all test output size are the same.

How can we do to change encoder birate?

This is our test log:

******************************************************************

Test1:
[2025-05-16 11:04:51.261] gst-launch-1.0 videotestsrc pattern=ball num-buffers=5000 ! video/x-raw, format=NV12, wiidth=852, height=480, framerate=30/1 ! v4l2h264enc extra-controls="enc,frame_level_rate_control_enable=1,video_bitrate_mo de=1,video_bitrate=5000000" ! h264parse ! filesink location=/test_streams/demo5mbps.264 t m p/demo5mbps
[2025-05-16 11:05:19.414] [ 457.696474] pix_mp->plane_fmt[0].sizeimage 37440, widthxheight=(416x240)
[2025-05-16 11:05:19.430] Setting pipeline to PAUSED ...
[2025-05-16 11:05:19.430] [ 457.708560] pix_mp->plane_fmt[0].sizeimage 37440, widthxheight=(416x240)
[2025-05-16 11:05:19.445] [ 457.718738] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.445] [ 457.725451] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.461] [ 457.732287] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.461] [ 457.739037] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.461] [ 457.745843] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.476] [ 457.752608] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.476] [ 457.759357] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.492] [ 457.766095] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.492] [ 457.772841] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.508] [ 457.779584] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.508] [ 457.786335] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:05:19.523] Pipeline is PREROLLING ...
[2025-05-16 11:05:19.523] [ 457.795719] pix_mp->plane_fmt[0].sizeimage 2097152, widthxheight=(852x480)
[2025-05-16 11:05:19.523] Redistribute latency...
[2025-05-16 11:05:19.523] [ 457.804045] pix_mp->plane_fmt[0].sizeimage 2097152, widthxheight=(852x480)
[2025-05-16 11:05:19.570] Pipeline is PREROLLED ...
[2025-05-16 11:05:19.570] Setting pipeline to PLAYING ...
[2025-05-16 11:05:19.570] New clock: GstSystemClock
[2025-05-16 11:05:50.053] Got EOS from element "pipeline0".
[2025-05-16 11:05:50.069] Execution ended after 0:00:30.494698680
[2025-05-16 11:05:50.069] Setting pipeline to NULL ...
[2025-05-16 11:05:50.069] Freeing pipeline ...
[2025-05-16 11:05:50.084] root@j721s2-evm:/opt/vision_apps#

Test2:
[2025-05-16 11:06:01.241] root@j721s2-evm:/opt/vision_apps# gst-launch-1.0 videotestsrc pattern=ball num-buffers=5000 ! video/x-raw, format=NV12, wiidth=852, height=480, framerate=30/1 ! v4l2h264enc extra-controls="enc,frame_level_rate_control_enable=1,video_bitrate_mo de=1,video_bitrate=20000000" ! h264parse ! filesink location=/test_streams/demo20mbps.264 t m p
[2025-05-16 11:06:11.961] [ 510.238283] pix_mp->plane_fmt[0].sizeimage 37440, widthxheight=(416x240)
[2025-05-16 11:06:11.976] Setting pipeline to PAUSED ...
[2025-05-16 11:06:11.976] [ 510.250577] pix_mp->plane_fmt[0].sizeimage 37440, widthxheight=(416x240)
[2025-05-16 11:06:11.976] [ 510.260362] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:11.992] [ 510.267414] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:11.992] [ 510.274212] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.008] [ 510.280962] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.008] [ 510.287723] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.023] [ 510.294512] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.023] [ 510.301291] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.023] [ 510.308056] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.039] [ 510.314812] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.039] [ 510.321548] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.054] [ 510.328323] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:12.054] Pipeline is PREROLLING ...
[2025-05-16 11:06:12.054] [ 510.336965] pix_mp->plane_fmt[0].sizeimage 2097152, widthxheight=(852x480)
[2025-05-16 11:06:12.071] Redistribute latency...[ 510.346103] pix_mp->plane_fmt[0].sizeimage 2097152, widthxheight=(852x480)
[2025-05-16 11:06:12.071]
[2025-05-16 11:06:12.102] Pipeline is PREROLLED ...
[2025-05-16 11:06:12.102] Setting pipeline to PLAYING ...
[2025-05-16 11:06:12.102] New clock: GstSystemClock
[2025-05-16 11:06:43.250] Got EOS from element "pipeline0".
[2025-05-16 11:06:43.250] Execution ended after 0:00:31.143707420
[2025-05-16 11:06:43.250] Setting pipeline to NULL ...
[2025-05-16 11:06:43.250] Freeing pipeline ...

Test3:
[2025-05-16 11:06:43.265] root@j721s2-evm:/opt/vision_apps# gst-launch-1.0 videotestsrc pattern=ball num-buffers=5000 ! video/x-raw, format=NV12, wiidth=852, height=480, framerate=30/1 ! v4l2h264enc extra-controls="enc,frame_level_rate_control_enable=1,video_bitrate_mo de=1,video_bitrate=100000000" ! h264parse ! filesink location=/test_streams/demo100mbps.264 m p
[2025-05-16 11:06:52.547] [ 550.824212] pix_mp->plane_fmt[0].sizeimage 37440, widthxheight=(416x240)
[2025-05-16 11:06:52.547] Setting pipeline to PAUSED ...
[2025-05-16 11:06:52.563] [ 550.836249] pix_mp->plane_fmt[0].sizeimage 37440, widthxheight=(416x240)
[2025-05-16 11:06:52.563] [ 550.846171] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.579] [ 550.853129] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.579] [ 550.859954] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.594] [ 550.866723] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.594] [ 550.873484] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.594] [ 550.880360] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.610] [ 550.887138] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.610] [ 550.893879] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.625] [ 550.900625] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.625] [ 550.907388] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.641] [ 550.914137] pix_mp->plane_fmt[0].sizeimage 12288, widthxheight=(256x128)
[2025-05-16 11:06:52.641] Pipeline is PREROLLING ...
[2025-05-16 11:06:52.641] [ 550.923525] pix_mp->plane_fmt[0].sizeimage 2097152, widthxheight=(852x480)
[2025-05-16 11:06:52.657] Redistribute latency...
[2025-05-16 11:06:52.657] [ 550.931860] pix_mp->plane_fmt[0].sizeimage 2097152, widthxheight=(852x480)
[2025-05-16 11:06:52.688] Pipeline is PREROLLED ...
[2025-05-16 11:06:52.688] Setting pipeline to PLAYING ...
[2025-05-16 11:06:52.703] New clock: GstSystemClock
[2025-05-16 11:07:23.213] Got EOS from element "pipeline0".
[2025-05-16 11:07:23.213] Execution ended after 0:00:30.521193976
[2025-05-16 11:07:23.229] Setting pipeline to NULL ...
[2025-05-16 11:07:23.229] Freeing pipeline ...

Result:
[2025-05-16 11:07:23.229] root@j721s2-evm:/opt/vision_apps# ls -l tmp /tmp/
[2025-05-16 11:08:28.151] -rw-r--r-- 1 root root 2624313 Aug 30 11:53 demo100mbps.264
[2025-05-16 11:08:28.151] -rw-r--r-- 1 root root 2624313 Aug 30 11:52 demo20mbps.264
[2025-05-16 11:08:28.151] -rw-r--r-- 1 root root 2624313 Aug 30 11:51 demo5mbps.264

  • Hello, 

    Are you able to move to a newer SDK? This SDK is quite old and has a lot of bugs.

    Thanks,
    Sarabesh S.

  • Hi Sarabesh,
    Since our project has already progressed to the later stage, it is unlikely and we don’t have time to update to the new SDK. Can you provide assistance for sdk8.4?

  • Hi John, 

    Sorry for the delay. Let me discuss internally with our development team. 

    Thanks,
    Sarabesh S.

  • Hi Sarabesh,
    How about this issue? Have any update?

  • Hi John, are you exclusively trying this in vision-apps (Linux+RTOS)? If so, are you able to try this on the Linux only SDK?

    Thank you,
    Sarabesh S.

  • Hi Sarabesh

    We test with linux console cmd:

    gst-launch-1.0 videotestsrc pattern=ball num-buffers=5000 ! video/x-raw, format=NV12, wiidth=852, height=480, framerate=30/1 ! v4l2h264enc extra-controls="enc,frame_level_rate_control_enable=1,video_bitrate_mo de=1,video_bitrate=5000000" ! h264parse ! filesink location=/test_streams/demo5mbps.264 t m p/demo5mbps

  • And what logs do you see? Can you run with GST_DEBUG=2?

    Thank you,
    Sarabesh S.

  • This is our test log.

    >>>>>>>>>>>>>>>>>>>>>>>>demo5mbps.264

    root@j721s2-evm:~# GST_DEBUG=2 gst-launch-1.0 videotestsrc pattern=ball num-buffers=5000 ! video/x-raw, format=NV12, width=852, height=480, framerate=30/1 ! v4l2h264enc extra-controls="enc,frame_level_rate_control_enable=1,video_bitrate_mode=1,video_bitrate=5000000" ! h264parse ! filesink location=/tmp/demo5mbps.264

    Setting pipeline to PAUSED ...

    0:00:00.069428060  1191     0x23099870 WARN                    v4l2 gstv4l2object.c:4292:gst_v4l2_object_probe_caps:<v4l2h264enc0:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Invalid argument

    Pipeline is PREROLLING ...

    Redistribute latency...

    0:00:00.187730045  1191     0x23094800 WARN          v4l2bufferpool gstv4l2bufferpool.c:820:gst_v4l2_buffer_pool_start:<v4l2h264enc0:pool:sink> Uncertain or not enough buffers, enabling copy threshold

    0:00:00.201729405  1191     0x23094800 WARN          v4l2bufferpool gstv4l2bufferpool.c:820:gst_v4l2_buffer_pool_start:<v4l2h264enc0:pool:src> Uncertain or not enough buffers, enabling copy threshold

    Pipeline is PREROLLED ...

    Setting pipeline to PLAYING ...

    New clock: GstSystemClock

    0:00:38.229658210  1191 0xffff9801a9e0 WARN           v4l2allocator gstv4l2allocator.c:1370:gst_v4l2_allocator_dqbuf:<v4l2h264enc0:pool:src:allocator> V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0

    Got EOS from element "pipeline0".

    Execution ended after 0:00:38.024893670

    Setting pipeline to NULL ...

    0:00:38.231722740  1191     0x23099870 WARN              bufferpool gstbufferpool.c:1408:gst_buffer_pool_set_flushing:<v4l2h264enc0:pool:sink> can't change flushing state of inactive pool

    0:00:38.231887000  1191     0x23099870 WARN              bufferpool gstbufferpool.c:1408:gst_buffer_pool_set_flushing:<v4l2h264enc0:pool:sink> can't change flushing state of inactive pool

    Freeing pipeline ...

     

    >>>>>>>>>>>>>>demo20mbps.264

    root@j721s2-evm:~# GST_DEBUG=2 gst-launch-1.0 videotestsrc pattern=ball num-buffers=5000 ! video/x-raw, format=NV12, width=852, height=480, framerate=30/1 ! v4l2h264enc extra-controls="enc,frame_level_rate_control_enable=1,video_bitrate_mode=1,video_bitrate=20000000" ! h264parse ! filesink location=/tmp/demo20mbps.264

    Setting pipeline to PAUSED ...

    0:00:00.068492765  1439     0x1fb09870 WARN                    v4l2 gstv4l2object.c:4292:gst_v4l2_object_probe_caps:<v4l2h264enc0:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Invalid argument

    Pipeline is PREROLLING ...

    Redistribute latency...

    0:00:00.186648075  1439     0x1fb04800 WARN          v4l2bufferpool gstv4l2bufferpool.c:820:gst_v4l2_buffer_pool_start:<v4l2h264enc0:pool:sink> Uncertain or not enough buffers, enabling copy threshold

    0:00:00.200201555  1439     0x1fb04800 WARN          v4l2bufferpool gstv4l2bufferpool.c:820:gst_v4l2_buffer_pool_start:<v4l2h264enc0:pool:src> Uncertain or not enough buffers, enabling copy threshold

    Pipeline is PREROLLED ...

    Setting pipeline to PLAYING ...

    New clock: GstSystemClock

    0:00:38.352780645  1439 0xffffb401a9e0 WARN           v4l2allocator gstv4l2allocator.c:1370:gst_v4l2_allocator_dqbuf:<v4l2h264enc0:pool:src:allocator> V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0

    Got EOS from element "pipeline0".

    Execution ended after 0:00:38.149629345

    Setting pipeline to NULL ...

    0:00:38.355049010  1439     0x1fb09870 WARN              bufferpool gstbufferpool.c:1408:gst_buffer_pool_set_flushing:<v4l2h264enc0:pool:sink> can't change flushing state of inactive pool

    0:00:38.355205415  1439     0x1fb09870 WARN              bufferpool gstbufferpool.c:1408:gst_buffer_pool_set_flushing:<v4l2h264enc0:pool:sink> can't change flushing state of inactive pool

    Freeing pipeline ...

  • Hi Sarabesh,
    how about this issue, please update the status.

  • Hello John, 

    My apologies I was out of office majority of June. To my knowledge there is not available patch we can provide on this SDK for bitrate if the functionality is not already present. I will review the codebase and get back to you.

    Thanks,
    Sarabesh S.

  • Hi Sarabesh,
    This project is ready to enter mass production. This issue has become very important. Please give high priority to it. Thank you.

  • Hi John, 

    Do you see V4L2 bitrate controls in the Linux driver when you search the code?

    Also could you please share the input stream that you are using? How long is the stream?

    Thanks,
    Sarabesh S.

  • Hi Sarabesh,

    Do you see V4L2 bitrate controls in the Linux driver when you search the code?
    [otobrite] : Can you point out which source code is in the Linux driver you are talking about?

    Also could you please share the input stream that you are using? How long is the stream?
    [otobrite] : the streaming example(cmd) was provided by you, please see the upper messages.

  • Hi John, 

    Yes, the source code is located in the linux kernel in drivers/media/platform/chipsnmedia/wave5.

    Regards,
    Sarabesh S.

  • Hi Sarabesh,
    we can't find chipsnmedia folder on linux kernel, 
    we just can find wave5 folder on psdk_linux/board-support/linux-5.10.120/drivers/staging/media/wave5.
    please help.

  • Let me confirm the path on the older kernel and get back to you.

    Thanks,
    Sarabesh S.

  • Hi Sarabesh,

    This issue is urgent, how about the status?

  • Hi John, apologies bandwidth has been limited. Yes I can confirm that the path is being used for the driver. I am still investigating whether bitrate control (and to what extent) is enabled in this version of the driver. It does look like the correct registers are being written to but some controls are missing. 

  • Hi John, 

    Please take a look at SDK 8.6 and cherry pick the necessary patches to enable V4l2 bitrate controls.

    It appears a big revert to the wave5 codebase was done on the update from 8.4 to 8.6 SDK. The commits for reverting and adding the new v4l2 layer are listed below.

    The driver took a big rework between those SDKs but it did happen on the same kernel version. We won't be able to provide any backport support so please proceed with the resources from the git tree.

    Thank you,
    Sarabesh S.