Gstreamer video playback rotation and custom playback area

cancel
Showing results for 
Search instead for 
Did you mean: 

Gstreamer video playback rotation and custom playback area

1,150 Views
sandeep_e
Contributor II

I am working on a custom imx6micro based device. I am trying to implement two features for gstreamer video playback,
1. Video rotation to 90, 180 and 270 degree.
2. Output the video playback to a particular area on framebuffer.

Current gstreamer pipeline used for video playback:
gst-launch-1.0 filesrc location=<path_to_the_mp4_video_file> ! decodebin ! imxg2dvideosink framebuffer=/dev/fb1 use-vsync=true sync=true

I tried using videoflip for rotation and videobox for displaying the video in a particular area on framebuffer. But processing time is high and the video plays slowly if i use any one(or even both) of these element in gstreamer pipeline. Gstreamer pipeline which i used is below,

gst-launch-1.0 filesrc location=<path_to_the_mp4_video_file> ! decodebin ! videobox left=0 right=0 top=-400 bottom=0 ! videoflip method=rotate-180 ! imxg2dvideosink framebuffer=/dev/fb1 use-vsync=true sync=false


Is there any other way to implement the above two features without slowing down the video playback?

Labels (3)
0 Kudos
6 Replies

1,136 Views
joanxie
NXP TechSupport
NXP TechSupport

what bsp version do you use? and what imx6 do you use? imx6q?

0 Kudos

1,127 Views
sandeep_e
Contributor II

I am using Yocto Morty based BSP and imx6q micro variant SOC.

0 Kudos

1,105 Views
joanxie
NXP TechSupport
NXP TechSupport

refer to the user guide of 4.9.11, pls refer to the chapter 7.3.15 Video conversion of enclosed file,how about use g2d plugins?

 

 

0 Kudos

1,087 Views
sandeep_e
Contributor II

Thanks for sharing the user guide. I tried to use the gstreamer plugin specified. But, the output is not suitable to our specific requirement.

1. For video rotation I used the below pipeline. Playback is rotated to 90degree, But the aspect ratio is not maintained. Instead, height and width of the playback area were fixed, resulting in the playback being stretched on one direction and compressed on other direction

gst-launch-1.0 filesrc location=/media/mmcblk1p1/DCIM/ilux/10000_2021_03_25_05_55_23_GEN_OD.mp4 ! qtdemux ! vpudec ! imxvideoconvert_g2d rotation=1 ! video/x-raw,format=RGB16,width=1920,height=1080 ! imxg2dvideosink framebuffer=/dev/fb0 use-vsync=true sync=true

Is there any way to actually rotate the playback area along with the contents of the video being rotated?

2. For modifying the video playback area coordinates, below pipeline works fine. This pipeline displays the playback on overlaysink. But, I need to display the video playback on the background framebuffer instead of the overlay. A QT application with UI will be running on the foreground framebuffer. I used color keying to make the video playback from background to be visible.

gst-launch-1.0 filesrc location=/media/mmcblk1p1/DCIM/ilux/10000_2021_03_25_05_55_23_GEN_OD.mp4 ! qtdemux ! vpudec ! overlaysink overlay-width=240 overlay-height=135 overlay-left=0 overlay-top=100 sync=true

Please suggest any solution to achieve the above results on background framebuffer.

0 Kudos

985 Views
joanxie
NXP TechSupport
NXP TechSupport

 for rotate, one can try to use the command like:
"# gst-launch-1.0 filesrc location=<name_of_the_video.mp4> ! qtdemux ! h264parse ! vpudec ! queue ! glimagesink rotate-method=1"

rotate-method=1 is for 90, rotate-method=2 is for 180, and rotate-method=3 is for 270

 

0 Kudos

985 Views
joanxie
NXP TechSupport
NXP TechSupport

 for rotate, one can try to use the command like:
"# gst-launch-1.0 filesrc location=<name_of_the_video.mp4> ! qtdemux ! h264parse ! vpudec ! queue ! glimagesink rotate-method=1"

rotate-method=1 is for 90, rotate-method=2 is for 180, and rotate-method=3 is for 270

 

0 Kudos