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.

Cropping using gstreamer on Netra/Centaurus



Hi,

Can someone help on how to crop the input frame and upscale using gstreamer pipeline, I need it on Centaurus? Specifically, I want to crop top-left part of the input frame (960x540) and scale it up to 1920x1080 on the output side. Is there a gstreamer plug-in which can be used for the same?

I tried finding it out on the below wiki but cropping is not mentioned there:

http://processors.wiki.ti.com/index.php/DM81xx_Gstreamer_Pipelines

Please help.

  • Hi,

    If this gstreamer is using V4L2 capture, than v4l2 capture has implemented V4L2_S_CROP ioctl to do cropping on incoming frames.

  • Hi Anuj,

     

    We cannot do inline unscaling, but we can support cropping with the 1x scaling and then captured video can be upscaled using m2m omx or any other component.

     

    Thx,

    Brijesh

  • I missed scaling part, it needs to be done using OMX VFPC component.

  • Hello Hardik,

    In my case i did the following changes to my SDCard created with ezsdk_05_04_00_11,

    cp /usr/share/ti/ti-media-controller-utils/load-hd-v4l2-firmware.sh /etc/init.d/load-hd-firmware.sh

    After re-boot, I am able to invoke the following decode pipeline

    gst-launch-0.10 filesrc location=1080p50.MTS ! mpegtsdemux ! h264parse !  omx_h264dec ! omx_scaler ! 'video/x-raw-yuv,width=1920,height=1080' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60  ! gstperf ! omx_videosink sync=true

    Now the question is:

    how to crop left-top 960x540 and scale up to full screen 1920x1080?

    Br,

    Albert.

  • Hello Hardik/Brijesh,

    Fist of all, my question is related to cropping the input video from the h264 file(not from v4l2 captured external video),

    coming back to your question related to omx_vfpc for scaling:

    I have tested following gstreamer pipelines:

    ############################downscaling 1080 video to 720#########################################################

    1920x1080 Input  file displayed natively as 1920x1080p video out(video was spanning over the full screen of my fullHD monitor):

    gst-launch-0.10 filesrc location=1920x1080p50.MTS ! mpegtsdemux ! h264parse !  omx_h264dec ! omx_scaler ! 'video/x-raw-yuv,width=1920,height=1080' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60  ! gstperf ! omx_videosink sync=true


    1920x1080 Input  file displayed as 1280x720 down scaled(video was looking small in the center on my FullHD monitor, remaining outer boundary was black)

    gst-launch-0.10 filesrc location=1920x1080p50.MTS ! mpegtsdemux ! h264parse !  omx_h264dec ! omx_scaler ! 'video/x-raw-yuv,width=1280,height=720' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60  ! gstperf ! omx_videosink sync=true


    ############################upscaling 720 video to 1080#########################################################

    1280x720 Input  file displayed natively without any scaling(video was looking small in the center on my FullHD monitor, remaining outer boundary was black)

    gst-launch-0.10 filesrc location=1280x720p24.MTS ! mpegtsdemux ! h264parse !  omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60  ! gstperf ! omx_videosink sync=true


    1280x720 Input  file displayed as 1920x1080p video out(video was spanning over the full screen)

    gst-launch-0.10 filesrc location=1280x720p24.MTS ! mpegtsdemux ! h264parse !  omx_h264dec ! omx_scaler ! 'video/x-raw-yuv,width=1920,height=1080' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60  ! gstperf ! omx_videosink sync=true



    with these example, it is clear that up-scale and down-scale with gstreamer omx_scalar component is working fine, So my question is:

    why and how  OMX VFPC component plays role in this cropping scenario? as i understood, omx_scalar internally uses OMX.VFPC component(In gstreamer my focus is only on omx_scalar plug-in).


    scaling with omx_scalar seems to be working fine in my case, i just need some magic component like omx_cropper which can be used in the following pipeline

    gst-launch-0.10 filesrc location=1920x1080p50.MTS ! mpegtsdemux ! h264parse !  omx_h264dec ! omx_cropper width=x height=y ! omx_scaler ! 'video/x-raw-yuv,width=1920,height=1080' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60  ! gstperf ! omx_videosink sync=true

    do we have such a component available? or before invoking my gst-pipeline, do i need to use a small userspace program for configuring the cropping parameters using IOCTL?


    btw: one more question

    with ezsdk 05.04.00.11, what happens when i replace the following script

    cp /usr/share/ti/ti-media-controller-utils/load-hd-v4l2-firmware.sh /etc/init.d/load-hd-firmware.sh?

    Is it affecting both capture and display functionalities using v4l2 driver?


    thanks and Br,

    Albert.

  • Hi Albert,

    Scalar component can do the cropping as well. In ezSDK 54011, cropping is not functional. It will be fixed in next release.

    Regards

    Vimal

  • Hello Vimal,

    At the moment I need a work-around to demonstrate cropping functionality. Is there any other way I can configure crop parameters(through IOCTL call) before invoking my gstreamer pipeline?

    thanks and Br,

    Albert.

  • Albert,

    By specifying nOffset in OMX buffer headers startX, startY can be changed. Also If scalar width/height is made as required cropping width/height, It may do the required cropping.

    Regards

    Vimal