After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 338991 - [patch] Videoscale doesn't pass on pixel-aspect ratio
[patch] Videoscale doesn't pass on pixel-aspect ratio
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal major
: 0.10.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-04-19 10:12 UTC by Christian Fredrik Kalager Schaller
Modified: 2006-04-28 14:33 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
patch to handle PAR better (3.86 KB, patch)
2006-04-20 16:21 UTC, Wim Taymans
none Details | Review
updated patch (4.87 KB, patch)
2006-04-24 10:05 UTC, Wim Taymans
committed Details | Review

Description Christian Fredrik Kalager Schaller 2006-04-19 10:12:02 UTC
Please describe the problem:
Videoscale resets the pixel aspect ratio of an incoming stream to 1/1 unless
specifically told not to through the caps. The default/correct behaviour should
be to keep the incoming pixel aspect ratio unless something else is specified.

Example of working gst-launch pipeline:
gst-launch-0.10 dvdreadsrc title="5" ! decodebin name="dvd" dvd. !
ffmpegcolorspace ! video/x-raw-yuv,format=\(fourcc\)YUY2 ! videoscale method=1 !
video/x-raw-yuv,format=\(fourcc\)YUY2,width=360,height=288,pixel-aspect-ratio=\(fraction\)16/15
! ffmpegcolorspace ! xvimagesink  dvd. ! audioconvert ! alsasink


Steps to reproduce:



Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Wim Taymans 2006-04-20 16:21:42 UTC
Created attachment 63971 [details] [review]
patch to handle PAR better

like so?
Comment 2 Tim-Philipp Müller 2006-04-20 16:51:32 UTC
The patch fixes the problem for me in Thoggen.
Comment 3 Fernando Herrera 2006-04-23 14:47:39 UTC
With this patch, using only width or height in the out caps it does not respect original aspect ratio.

Using this pipeline over a file with 480 x 368:
GST_DEBUG=videoscale:5 gst-launch-0.10 --gst-debug-no-color filesrc location="marlango y bose.avi" ! decodebin ! videoscale ! video/x-raw-yuv,width=100 ! ffmpegcolorspace ! ximagesink

gives this debug output:
DEBUG (0x8ae74c8 - 0:00:00.934618000)           videoscale(24650) gstvideoscale.c(586):gst_video_scale_fixate_caps:<videoscale0> scaling
input with 480x368 and PAR 1/1 to output PAR 1/1
DEBUG (0x8ae74c8 - 0:00:00.934641000)           videoscale(24650) gstvideoscale.c(588):gst_video_scale_fixate_caps:<videoscale0> resulting output should respect ratio of 30/23
DEBUG (0x8ae74c8 - 0:00:00.934660000)           videoscale(24650) gstvideoscale.c(597):gst_video_scale_fixate_caps:<videoscale0> keeping
video height
DEBUG (0x8ae74c8 - 0:00:00.934676000)           videoscale(24650) gstvideoscale.c(609):gst_video_scale_fixate_caps:<videoscale0> scaling
to 480x368
DEBUG (0x8ae74c8 - 0:00:00.934710000)           videoscale(24650) gstvideoscale.c(629):gst_video_scale_fixate_caps:<videoscale0> fixated
othercaps to video/x-raw-yuv, width=(int)100, height=(int)368, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)1/1, format=(fourcc)I420
Comment 4 Fernando Herrera 2006-04-23 15:22:28 UTC
Notice that also adding pixel-aspect-ratio to the above pipeline makes it loop forever.

This code works for me for calculating width/height when only one of them is provided:

    /* start with same height, because of interlaced video */
    if (h) {
      GST_DEBUG_OBJECT (base, "keeping video height");
      w = h * num / den;
    } else if (w) {
      GST_DEBUG_OBJECT (base, "keeping video width");
      h = w * den / num;
    } else {
      GST_DEBUG_OBJECT (base, "approximating but keeping video height");
      h = from_h;
      w = h * num / den;


Comment 5 Wim Taymans 2006-04-24 10:05:54 UTC
Created attachment 64187 [details] [review]
updated patch

don't ignore fixed output width and height.
Comment 6 Wim Taymans 2006-04-24 10:07:30 UTC
what do you mean with "adding pixel-aspect-ratio to the above pipeline makes it loop forever"? I was unable to produce something that loops forever.
Comment 7 Fernando Herrera 2006-04-24 10:16:39 UTC
Well, I'm not sure now if the loop was caused when adding videorate element or without it (see http://bugzilla.gnome.org/show_bug.cgi?id=339013 ). I will try again with clean HEAD versions.
Comment 8 Fernando Herrera 2006-04-24 10:24:41 UTC
Yes, without using videoscale at all:

gst-launch-0.10 -v --gst-debug-no-color filesrc location="Arrebato(Zulueta,1979).avi" ! decodebin ! videoscale ! video/x-raw-yuv,width=100,pixel-aspect-ratio=\(fraction\)1/1 ! ffmpegcolorspace ! ximagesink

works correctly (i.e: it plays)

but:
gst-launch-0.10 -v --gst-debug-no-color filesrc location="Arrebato(Zulueta,1979).avi" ! decodebin ! videoscale ! video/x-raw-yuv,width=100,pixel-aspect-ratio=\(fraction\)2/1 ! ffmpegcolorspace ! ximagesink

the pipeline remains in PAUSE state and never works:
[...]
/pipeline0/decodebin0/mad0.src: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int)48000, channels=(int)2

Program received signal SIGINT, Interrupt.

Thread NaN (LWP 1632)

  • #0 __kernel_vsyscall
  • #1 poll
    from /lib/libc.so.6
  • #2 g_main_context_iterate
    at gmain.c line 2849
  • #3 IA__g_main_loop_run
    at gmain.c line 2751
  • #4 gst_bus_poll
    at gstbus.c line 858
  • #5 event_loop
    at gst-launch.c line 367
  • #6 main
    at gst-launch.c line 646

Comment 9 Wim Taymans 2006-04-24 11:17:47 UTC
ok, that is normal, gst-launch cannot make a connection to ximagesink when the pixel-aspect-ratio does not match that of the xserver, the pipeline never prerolls.

Does the patch otherwise work for you?
Comment 10 Wim Taymans 2006-04-28 14:33:58 UTC
        * gst/videoscale/gstvideoscale.c: (gst_video_scale_transform_caps),
        (gst_video_scale_fixate_caps), (gst_video_scale_src_event):
        Videoscale doesn't pass on pixel-aspect ratio. Handle all
        fixation cases better. Fixes #338991