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.

PROCESSOR-SDK-AM437X: Video alignment with GStreamer

Part Number: PROCESSOR-SDK-AM437X

I am using TI sitara EVM 437x. I need to play a mp4 video directly on the frame buffer. For that by stopping weston I run gstreamer pipeline as follow. I am successfully able to run video but it is aligned to center only. 

I am using this pipeline : # gst-launch-1.0 -v filesrc location = ./promo_video_small.mp4 ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=450,height=280 ! fbdevsink
here is the output :


by changing value of width and height I can change the video display dimensions.

for shifting video to desired x,y position I tried with following pipeline : # gst-launch-1.0 -v filesrc location = ./promo_video_small.mp4 ! decodebin ! videoconvert ! videobox border-alpha=0 ! videobox alpha=0 left=-450 right=-50 top=0 bottom=0 ! videoscale ! video/x-raw,width=380,height=300 ! fbdevsink device=/dev/fb0

By using this pipeline the video is getting compressed i.e. from left border video shifts to right but right border remains as it is or can shift to left but can not shift further in right direction, and while shifting it  left black box behind video in background having same size of video frame we have given in pipeline.

if I write +value in left and top or any other margin value it crops the image while -value add the pixel this I read somewhere in videobox property.

here is the output :

how to remove this black box shown on left and right side of the video and how to shift the video without affecting its size of video having transparent background.

  • The software team have been notified. They will respond here.
  • Hello,

    The "blackbox" is normal since the default value of the videobox fill property is "black". For example if you use:

    gst-launch-1.0 -v  videotestsrc ! videoconvert ! videobox border-alpha=0 ! videobox alpha=0 left=-450 right=-50 top=0 bottom=0 fill=3 ! videoscale ! video/x-raw,width=380,height=300 ! autovideosink

    it will be red.

    For more information regarding videobox element you could check here:

    BR

    Margarita

  • thank you for your reply yes black is default. but i want transparent there plus the same problem is there video size is getting modify. I dont want it I want to simply shift it. And I am using device's frame buffer directly so can not use autovideosink. This will not display video on fb...
  • Hello,

    The videobox element is not a TI element.
    With gst-inspect-1.0 you could check the properies of the gst videobox element.

    BR
    Margarita
  • yes I know but with the same property I am able to shift in ui but it is not working on framebuffer of TI sitara EVM AM437x. that's why I post to TI

  • Hello,

    In your pipeline why you have two videobox elements
    (" videobox border-alpha=0 ! videobox alpha=0 left=-450 right=-50 top=0 bottom=0")?

    Could you try to remove or replace the videoscale element. You could try to move it before the videobox.

    videoscale ! video/x-raw,width=380,height=300 ! videobox alpha=0 left=-450 right=-50 top=0 bottom=0 ! ...

    Let me know do you observe any difference.

    Could you let me know what is the gstreamer version that you are using also?

    BR
    Margarita
  • yaa its working fine.. omg.. Thank you so much. Thanks a lot

  • Hello,

    I am glad that the issue is solved.


    BR
    Margarita
  • video shifting is done perfect but how to remove the black box filling I want there transparent background... any suggestion please?
  • Hello,

    Do you mean the fill property of the videobox element, this blackbox?


    BR
    Margarita
  • Hello,

    According the videobox documentation it seems like videobox must takes video format that includes an alpha channel e.g. RGBA.
    This could be set by using capsfilter and videoconvert element.

    Something like this should work also(change autovideosink element):
    gst-launch-1.0 -v videomixer name=mix ! videoconvert ! autovideosink videotestsrc pattern=0 ! video/x-raw,format=RGBA, framerate=1/1, width=350,height=250 ! videoconvert ! videobox border-alpha=0 top=-200 left=-50 ! mix.


    BR
    Margarita
  • yes that fill property. As I'll write value <0 in left or right margin for shifting purpose it adds a border and shift video. the default colour of that border is black which I can change using fill property. but not getting transparent.
  • Hello,

    Please check my previous answer.

    BR
    Margarita
  • how to write for fbdevsink. Ican't use autovideosink as I want the display on frame buffer. I change fbdevsink in place of autovideosink in the same syntax suggested by you and it works fine but I am using video file from my board. So how to write pipeline for that? I am writing as follow but getting syntax error.

    gst-launch-1.0 -v videomixername = mix ! fbdevsink ! filesrc location = ./promo_video_small.mp4 ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=450,height=300 ! videobox alpha=0 left=-150 right=-50 top=0 bottom=0 ! mix.
  • Hello,

    Could you post me the error?

    BR
    Margarita
  • sure.
    here is the warning and then pipeline breaks
    WARNING: erroneous pipeline: syntax error
  • Hello,

    Anjani Gandhi said:
    gst-launch-1.0 -v videomixername = mix ! fbdevsink ! filesrc location = ./promo_video_small.mp4 ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=450,height=300 ! videobox alpha=0 left=-150 right=-50 top=0 bottom=0 ! mix.

    Could you try?

    gst-launch-1.0 -v videomixer name = mix ! fbdevsink ! filesrc location = ./promo_video_small.mp4 ! decodebin ! videoconvert  !  video/x-raw,format=RGBA ! videoscale ! video/x-raw,width=450,height=300 ! videobox alpha=0 left=-150 right=-50 top=0 bottom=0 ! mix.

    or

    gst-launch-1.0 -v videomixer name = mix !  videoconvert  ! fbdevsink ! filesrc location = ./promo_video_small.mp4 ! decodebin ! videoconvert  !  video/x-raw,format=RGBA ! videoscale ! video/x-raw,width=450,height=300 ! videobox alpha=0 left=-150 right=-50 top=0 bottom=0 ! mix.

    BR
    Margarita

  • ma'am I tried but not working
    WARNING: erroneous pipeline: could not link fbdevsink0 to filesrc0
  • ma'am I have one doubt. In the document of gstreamer fill property (enum GstVideoBoxFill) has following members like some main 5 to 6 colors and "last" as VIDEO_BOX_FILL_LAST member. I tried to put different numeric values and got different colors as mention in list of members also can assign alphabetic value by writing in "". but not able to write or assign last as well as no value assign for that.. what is this last?
    ref link : gstreamer.freedesktop.org/.../gst-plugins-good-plugins-videobox.html
  • Hello,

    Could you try:

    gst-launch-1.0 filesrc location = divx-alien2003.avi ! decodebin ! videoconvert ! video/x-raw,format=AYUV ! videobox border-alpha=0 top=-70 bottom=-70 right=-220 ! videomixer name=mix ! videoconvert ! fbdevsink

    gst-launch-1.0 filesrc location = divx-alien2003.avi ! decodebin ! videoconvert ! alpha ! videobox border-alpha=0 top=-70 bottom=-70 right=-220 ! videomixer name=mix ! videoconvert ! fbdevsink

    In first case the first videoconvert element is for converting to AYUV. In second case alpha element is use for adding alpha channel to the video stream.
    In both cases you need this alpha for transparent.

    Let me know the result.
    Please change the name of the video stream.

    BR
    Margarita
  • Mam thank you so much for your support and response. It means a lot to me.

    yes mam I understand this and I am getting background as transparent background we can have while open a any such png image.but it is not transparent. I tried as follow

    gst-launch-1.0 filesrc location = ./promo_video.mp4 ! decodebin ! videoconvert ! alpha ! videoscale ! video/x-raw,width=450,height=300 ! videobox border-alpha=0 left =-350 top=-70 bottom=0 right=0 ! videomixer name=mix ! videoconvert ! fbdevsink

    and the output is :

    here I have fill the background with randome colors first using /dev/urandom

    ma'am my ultimate purpose is to demonstrate video as well as image on same fb. let say any image is already there on screen and over it a video has to play... but image is not fix it may be or may not be... so such kind of background overlay is not acceptable. and image status may vary so I cant use here mixer to stitch image and video.

    I need all the rest background be as it is. so my background image doesn't effect.

  • Hello,

    In theory, it seems that if you set the alpha-border property to 0 the border(the black box) should be transparent.
    Are you able to make this border transparent when you executing the pipeline on PC?

    BR
    Margarita
  • yes ma'am. but how I explain you it writes the screen with transparent layout image, in this context transparent means no color. but it is not transparent to let us see background.

    ok for example if we take a transparent layer initially it has white and gray boxes right? so this fills such boxes as transparent color. you can zoom out my image and check.

    I am confusing but I hope I am able to convey what problem I am facing.

    thank you

  • I refer this link. it may useful to me but not able to get it work properly in my case.
    wiki.oz9aec.net/.../Gstreamer_cheat_sheet
    can someone please help me out if having any idea about writing on device's frame buffer.
  • Hello,

    It is not working because is for gstreamer 0.10 which is use ffmpegcolorspace instead of videoconvert.
    You could try :
    gst-launch-1.0 -e videotestsrc pattern="snow" ! video/x-raw, format=AYUV, framerate=10/1, width=200, height=150 ! videobox border-alpha=0 top=-20 left=-25 ! videomixer name=mix ! videoconvert ! xvimagesink videotestsrc ! video/x-raw, format=I420, framerate=10/1, width=640, height=360 ! mix.

    I would recommend you to check videobox source code for more information.


    BR
    Margarita
  • but I have to sink with fbdevsink, xvimage sink is not possible in my case.
  • hii mam I am facing another issue today with following syntax. Now I am not able to play video, even with the same syntax working yesterday.

    input is :

    gst-launch-1.0 filesrc location = ./promo_video.mp4 ! decodebin ! videoconvert ! alpha ! videoscale ! video/x-raw,width=450,height=300 ! videobox border-alpha=0 left =-350 top=-70 bottom=0 right=0 ! videomixer name=mix ! videoconvert ! fbdevsink

    error is :

    Setting pipeline to PAUSED ...
    Pipeline is PREROLLING ...
    ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind: Stream contains no data.
    Additional debug info:
    ../../../gstreamer-1.6.3/plugins/elements/gsttypefindelement.c(1072): gst_type_find_element_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind:
    Can't typefind empty stream
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to NULL ...
    Freeing pipeline ...

    can you please point out my mistake?

    thank you

  • Hello,

    The pipeline seems fine.
    What you mean by "with the same syntax working yesterday"? The same pipeline was working yesterday but it does not, correct?
    Could you try with different video file?

    Let me know.

    BR
    Margarita
  • Hello,

    I am wondering one more thing.
    You know that videomixer element has properties like ypos, xpos etc.
    You could check the properties by command gst-inspect-1.0 videomixer.
    So the pipeline like this should work also:
    gst-launch-1.0 filesrc location =alien2003.avi ! decodebin ! videoconvert ! alpha ! videoscale ! video/x-raw,width=450,height=300 ! videomixer sink_0::xpos=100 sink_0::ypos=480 sink_1::alpha=0.0 name=mix ! videoconvert ! fbdevsink
    As you could see there is no videobox element. You could check this also if it will match to your use case.

    BR
    Margarita
  • yes I mean the same but I replace the video and its working.

    About your next reply xpos and y pos property I tried that but not getting any affect. I am getting the same effect as previous one. border fill with transparent pattern square boxes with centre alignment.

    Thank you