GNOME Bugzilla – Bug 691827
videoscale: display aspect ratio is not maintained
Last modified: 2013-03-21 10:24:04 UTC
Hello, i am using gstreamer version 0.10.36. My Display plane has size 1920*1080. when i display a picture with resolution 1920*1920, on display i see a picture with resolution 1920*1080 but it should be 1080*1080. i observe that videoscale returns give size 1920*1080 to my displaysink instead of 1080*1080. add_border property is also TRUE. is it a know issue with gstreamer-base-plugin? Thanks & Regards, Pavan Goyal
Created attachment 233570 [details] [review] patch to modify videoscale element to correct aspect ratio attached patch in videoscale element maintains the aspect ratio. please let me know if its a correct solution or how can it be proceeded. Thanks & Regards, Pavan Goyal
Can you provide a testcase for this, e.g. a gst-launch line?
Hello Sebastian, like a below pipeline can be used, gst-launch filesrc location=colorbar.jpg ! jpegdec ! ffmpegcolorspace ! videoscale ! freeze ! autovideosink i am using a custom displaysink as per my hardware. my display plane size is 1920 * 1080. so when in my displaysink, get_caps is called, i return gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, 1920, "height", GST_TYPE_INT_RANGE, 1, 1080, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 100, 1, NULL); } so in set caps, for an image of resolution say 1920*1920, i get width=1920 and height 1080 but i should get width 1080 and height 1080. Thanks & Regards, Pavan Goyal (In reply to comment #2) > Can you provide a testcase for this, e.g. a gst-launch line?
Created attachment 233661 [details] sample jpeg image with resolution 2048*2048 i have also attached an sample image.
Could you also provide the (gzip/bzip2-ed) debug log output for: $ GST_DEBUG=*:5 gst-launch filesrc location=colorbar.jpg ! jpegdec ! ffmpegcolorspace ! videoscale ! autovideosink 2>dbg.log ?
Created attachment 233666 [details] log attached with command GST_DEBUG=*:5 gst-launch filesrc location=test_2048*2048.jpg ! jpegdec ! ffmpegcolorspace ! videoscale ! autovideosink 2>debug.log log is attached which was captured with command GST_DEBUG=*:5 gst-launch filesrc location=test_2048*2048.jpg ! jpegdec ! ffmpegcolorspace ! videoscale ! autovideosink 2>debug.log using attached image. Regards, Pavan Goyal
Created attachment 233667 [details] debug log 2
Created attachment 233668 [details] debug log 3
Created attachment 233669 [details] debug log 4
log was huge (more than 3000 kb) so has been broken into parts since bugzilla does not allow more than 1000 kb.
Yes, that's why I suggested you gzip it ;) Thanks for the log.
Unfortunately the debug log doesn't print out the caps, because you are using a libc that doesn't support printf extensions. But anyway, what are the full caps you get in set_caps at the sink? I'm guessing you're getting a non-1/1 pixel-aspect-ratio then? Which would be fine, since your sink's get_caps does not contain any pixel-aspect-ratio field, so claims to be able to handle any (e.g. because it can scale itself). If that's what's actually happening, it's not clear to me that it is preferable to rescale horizontally as well to maintain the aspect ratio then, vs. just passing it through.
$ gst-launch-0.10 filesrc location= /home/tpm/samples/misc/691827-2048x2048.jpg ! jpegdec ! videoscale ! appsink caps='video/x-raw-yuv,width=[1,1920],height=[1,1080],framerate=[0/1,100/1]' -v /GstPipeline:pipeline0/GstAppSink:appsink0.GstPad:sink: caps = video/x-raw-yuv, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, format=(fourcc)I420, pixel-aspect-ratio=(fraction)9/16 $ gst-launch-0.10 filesrc location= /home/tpm/samples/misc/691827-2048x2048.jpg ! jpegdec ! videoscale ! appsink caps='video/x-raw-yuv,width=[1,1920],height=[1,1080],framerate=[0/1,100/1],pixel-aspect-ratio=1/1' -v /GstPipeline:pipeline0/GstAppSink:appsink0.GstPad:sink: caps = video/x-raw-yuv, width=(int)1080, height=(int)1080, framerate=(fraction)0/1, pixel-aspect-ratio=(fraction)1/1, format=(fourcc)I420
Hello Philipp, Thanks for your analysis. it realy helps. yes, without setting any pixel-aspect-ratio, i get same string as you mentioned. root@PAVAN-SDK2:~# gst-launch filesrc location=test-2048x2048.jpg ! jpegdec ! ffmpegcolorspace ! videoscale ! freeze ! autovideosink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... gst_st_v4l2_object_get_caps_info-525:video/x-raw-rgb, bpp=(int)32, depth=(int)32, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, endianness=(int)4321, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, pixel-aspect-ratio=(fraction)9/16; Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock ^CCaught interrupt -- handling interrupt. Interrupt: Stopping pipeline ... Execution ended after 5201580732 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... root@PAVAN-SDK2:~# but if i set pixel-aspect-ratio to 1/1, i get width=1 and height=1980 not 1080 & 1080 as you got. with, if (gst_st_v4l2_formats[i].dimensions) { gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, MAX_ALLOC_WIDTH, "height", GST_TYPE_INT_RANGE, 1, MAX_ALLOC_HEIGHT, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 100, 1, NULL); } root@PAVAN-SDK2:~# gst-launch filesrc location=test-2048x2048.jpg ! jpegdec ! ffmpegcolorspace ! videoscale ! freeze ! autovideosink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... gst_st_v4l2_object_get_caps_info-525:video/x-raw-rgb, bpp=(int)32, depth=(int)32, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, endianness=(int)4321, width=(int)1, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)0/1; Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock ^CCaught interrupt -- handling interrupt. Interrupt: Stopping pipeline ... Execution ended after 34845658113 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... am i missing something!! Thanks & Regards, Pavan Goyal
Hello Philipp, Thanks for your analysis. it realy helps. yes, without setting any pixel-aspect-ratio, i get same string as you mentioned. root@PAVAN-SDK2:~# gst-launch filesrc location=test-2048x2048.jpg ! jpegdec ! ffmpegcolorspace ! videoscale ! freeze ! autovideosink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... gst_st_v4l2_object_get_caps_info-525:video/x-raw-rgb, bpp=(int)32, depth=(int)32, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, endianness=(int)4321, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, pixel-aspect-ratio=(fraction)9/16; Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock ^CCaught interrupt -- handling interrupt. Interrupt: Stopping pipeline ... Execution ended after 5201580732 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... root@PAVAN-SDK2:~# but if i set pixel-aspect-ratio to 1/1, i get width=1 and height=1980 not 1080 & 1080 as you got. with, if (gst_st_v4l2_formats[i].dimensions) { gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, MAX_ALLOC_WIDTH, "height", GST_TYPE_INT_RANGE, 1, MAX_ALLOC_HEIGHT, "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 100, 1, NULL); } root@PAVAN-SDK2:~# gst-launch filesrc location=test-2048x2048.jpg ! jpegdec ! ffmpegcolorspace ! videoscale ! freeze ! autovideosink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... gst_st_v4l2_object_get_caps_info-525:video/x-raw-rgb, bpp=(int)32, depth=(int)32, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, endianness=(int)4321, width=(int)1, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)0/1; Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock ^CCaught interrupt -- handling interrupt. Interrupt: Stopping pipeline ... Execution ended after 34845658113 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... am i missing something!! Thanks & Regards, Pavan Goyal
with the suggestion provided by Phillip in comment 12, i am able to achieve desired display aspect ration. this issue can be closed. Thanks & Regards, Pavan Goyal
I think this is fixed in git master now. *** This bug has been marked as a duplicate of bug 696019 ***