Opened 3 years ago

Last modified 21 months ago

#7437 reopened defect

Canvas filter messes up aspect ratio

Reported by: https://www.google.com/accounts/o8/id?id=aitoawm5y_iskhwvi2-ear7exnsdu54jyb4fqzq Owned by:
Priority: normal Milestone: Bugs paradize
Component: Video: filters Version: master git
Severity: normal Keywords:
Cc: Difficulty: unknown
Platform(s): all Work status: Not started

Description

I run vlc with '--video-filter=canvas{width=800,height=600,aspect=4:3}' option, expecting it to scale the video and add black stripes below and above. Instead, it adds the black stripes and changes aspect ratio in a strange way. When I force aspect ratio to be 4:3, the video is correct.

I attach a patch that fixes this issue, but I'm not 100% sure it's correct (meaning that it could break something else). It removes some aspect ratio calculations at the end of canvas filter. My intuition is that since canvas filter simply applies scale and croppadd filters, the aspect ratio should be already correctly set by croppadd filter.

I've spotted this bug in VLC on Ubuntu 12.04 in the version from Ubuntu repositories (2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)) and in the version compiled from git (2.1.0-git Rincewind (revision 07ee81e)).

Attachments (3)

patch (999 bytes) - added by https://www.google.com/accounts/o8/id?id=aitoawm5y_iskhwvi2-ear7exnsdu54jyb4fqzq 3 years ago.
canvas-bad.jpg (351.8 KB) - added by https://www.google.com/accounts/o8/id?id=aitoawm5y_iskhwvi2-ear7exnsdu54jyb4fqzq 3 years ago.
canvas-good.jpg (336.8 KB) - added by https://www.google.com/accounts/o8/id?id=aitoawm5y_iskhwvi2-ear7exnsdu54jyb4fqzq 3 years ago.

Download all attachments as: .zip

Change History (16)

Changed 3 years ago by https://www.google.com/accounts/o8/id?id=aitoawm5y_iskhwvi2-ear7exnsdu54jyb4fqzq

Changed 3 years ago by https://www.google.com/accounts/o8/id?id=aitoawm5y_iskhwvi2-ear7exnsdu54jyb4fqzq

Changed 3 years ago by https://www.google.com/accounts/o8/id?id=aitoawm5y_iskhwvi2-ear7exnsdu54jyb4fqzq

comment:1 Changed 3 years ago by courmisch

  • Type changed from defect to patch

comment:2 Changed 3 years ago by ileoo

croppadd filter doesn't touch the aspect-ratio. But the patch seems to work, even if I think that there is a bug somewhere else in vout-side or canvas doesn't do all the tricks to set aspect ratio for vout side.

Canvas filter is usually used with sout and it has been working in that side.

comment:3 Changed 3 years ago by ileoo@…

  • Resolution set to fixed
  • Status changed from new to closed

commit 0f233f4980d0440b8357de629fee7fa0741c27b3 Author: Ilkka Ollakka <ileoo@…> Date: Fri Sep 7 18:03:00 2012 +0300

swscale: pass/calculate sar-info, should fix #7437

comment:4 Changed 3 years ago by jb

  • Milestone changed from Bugs paradize to 2.0.4

comment:5 Changed 3 years ago by linkfanel

  • Resolution fixed deleted
  • Status changed from closed to reopened

I suspect that there is something wrong with this fix. Now in 2.0.4, when using the transform filter to rotate the video, I get a stretched video. Manually setting the aspect ratio to 1:1 fixes it. When reverting to the swscale plugin of 2.0.3, the problem doesn't show up.

comment:6 Changed 3 years ago by funman

  • Milestone changed from 2.0.4 to 2.0.5

comment:7 Changed 3 years ago by courmisch

  • Milestone changed from 2.0.5 to Bugs paradize
  • Type changed from patch to defect

Unfixed -> unmiltestoned.

comment:8 Changed 3 years ago by ileoo@…

  • Resolution set to fixed
  • Status changed from reopened to closed

commit 0330378c55b8b940f6de82adb59cc32c5b3da12a Author: Ilkka Ollakka <ileoo@…> Date: Sun Nov 25 19:13:37 2012 +0200

swscale: fix aspect-ratio problem properly

works with transform filter now too, fixes #7437 again.

comment:9 Changed 3 years ago by courmisch

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:10 Changed 3 years ago by remi@…

  • Resolution set to fixed
  • Status changed from reopened to closed

commit b8f04c94af923a1f39b529b907dc0ca6e527e061 Author: Rémi Denis-Courmont <remi@…> Date: Fri Nov 30 00:04:33 2012 +0200

Revert "swscale: pass/calculate sar-info, should fix #7437"

This reverts commit 0330378c55b8b940f6de82adb59cc32c5b3da12a. This reverts commit 0f233f4980d0440b8357de629fee7fa0741c27b3.

Init() already initializes the aspect ratio, and does it correctly (unlike these two commits) with video_format_ScaleCropAr().

comment:11 Changed 3 years ago by courmisch

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:12 Changed 21 months ago by ILEoo

Can you try with 2.2 nightlies if this still happens?

comment:13 Changed 21 months ago by michał sapalski

FYI: I'm the original reporter, but it seems that OpenID login was changed since I've created this bug, so I don't show as 'https://www.google.com/accounts/o8/id?id=aitoawm5y_iskhwvi2-ear7exnsdu54jyb4fqzq' any more :)

I've checked the nightly version (http://nightlies.videolan.org/build/source/vlc-2.2.0-20131204-1431.tar.xz) and the bug seems to be fixed. I have a different computer and operating system (Ubuntu 13.10), but as far as I can remember this bug didn't seem to be platform-dependent.

Thanks for fixing this :)

Note: See TracTickets for help on using tickets.