Modify

Ticket #2581 (assigned Patch - Feature)

Opened 7 years ago

Last modified 15 months ago

Allow changing of aspect ratio when transcoding

Reported by: wagspat@… Owned by: cpinkham
Priority: minor Milestone: unknown
Component: MythTV - Mythtranscode Version: Master Head
Severity: medium Keywords: transcode aspect
Cc: Ticket locked: no

Description

This is a patch against 0.20 that accomplishes a couple of things. First, I've included my original fixes from #2198 on this, so 1080i streams are resized properly. Secondly, I've added a new setting for MPEG4 transcoders that sets the aspect ratio. This is exposed as a new option called "Aspect Ratio" with a drop-down menu that provides the options of "Leave", "4:3", and "16:9".

When selecting a different aspect ratio, the transcoded file will be cropped to the proper aspect ratio. So if the source is a 16:9 file recorded from an HDTV channel and the mpeg4aspectratio is set to 4:3, the sides will be cropped off when transcoding. This is very helpful for when you've recorded an SDTV program on an HDTV tuner (like the Simpsons).

Likewise, when set to 16:9, this will crop the tops off the file, which is useful if you've recorded a letterboxed program on an SDTV feed.

This helps to make the files more portable, makes watching recorded programs in MythTV behave properly when using a zoom mode, and may even promote world peace. If the powers that be conclude that this makes sense, I'll work on porting it to SVN. Unfortunately, right now I'm not running SVN because my wife likes a working myth box.

Attachments

aspectRatio.patch (10.8 KB) - added by wagspat@… 7 years ago.
example patch that implements aspect ratio setting on mpeg4 transcoders
aspectRatio-0-20-2.patch (10.2 KB) - added by wagspat@… 6 years ago.
updated version of the patch for 0.20.2
aspectRatio-0-20-2.a.patch (10.1 KB) - added by patrick@… 6 years ago.
updated version of the patch that adequately deals with non-square pixel videos
aspectRatio-0.21-fixes.patch (11.3 KB) - added by patrick@… 5 years ago.
patch against 0.21-fixes, revision #18812
2581_aspectRatio-trunk.patch (17.4 KB) - added by cpinkham 4 years ago.
Aspect Ratio patch modified to work with trunk & with deinterlacing ability

Change History

Changed 7 years ago by wagspat@…

example patch that implements aspect ratio setting on mpeg4 transcoders

comment:1 Changed 6 years ago by cpinkham

  • Owner changed from ijr to cpinkham

Changed 6 years ago by wagspat@…

updated version of the patch for 0.20.2

comment:2 Changed 6 years ago by patrick@…

I've gone through and updated this patch for the 0.20.2 release of MythTV. This patch also includes the fixes from #2198, which were put in the trunk by cpinkham in [11462], but haven't been backported to the 0.20 series.

Changed 6 years ago by patrick@…

updated version of the patch that adequately deals with non-square pixel videos

comment:3 Changed 6 years ago by patrick@…

I realized when I was updating my library last night that videos without square pixels, such as 720x480 NTSC captures weren't being resized to the right sizes. The newest patch fixes this issue and adds a warning if a video is not currently in 4:3 or 16:9, in which case it has no idea which dimension should become the dominant dimension.

I suppose I could probably do some sort of heuristic with this, but I don't think it's really worth it. Are there common video sources for MythTV that you may want to crop to an aspect ratio that aren't already in these formats?

comment:4 Changed 5 years ago by cpinkham

  • Version changed from 0.20 to head
  • Milestone changed from 0.21 to 0.22

Changed 5 years ago by patrick@…

patch against 0.21-fixes, revision #18812

comment:5 Changed 5 years ago by patrick@…

The latest version of the patch addresses only the issues with letterbox/pillarbox recordings. I removed all the old cruft that isn't needed because of changes to mythtv that resolved other tickets.

comment:6 Changed 4 years ago by Dibblah

  • Status changed from new to assigned

comment:7 Changed 4 years ago by anonymous

As an aside on DVB in UK films have different aspect rations to adverts - when archiving to DVD the aspects all look odd. Could we make is split the files on aspect ratio changes - then this could be used by the python to correctly create DVD's ?

Changed 4 years ago by cpinkham

Aspect Ratio patch modified to work with trunk & with deinterlacing ability

comment:8 Changed 4 years ago by cpinkham

  • Milestone changed from 0.22 to 0.23

I attached an updated version of the patch updated to work with trunk. It has been reworked a little to eliminate some code duplication and also has an added option to support deinterlacing the video before cropping and scaling.

comment:9 Changed 4 years ago by stuartm

  • Component changed from mythtv to MythTV - Mythtranscode

comment:10 Changed 3 years ago by cpinkham

  • Milestone changed from 0.23 to 0.24

Moving some things to 0.24 since we're almost at the 0.23 feature freeze.

comment:11 Changed 3 years ago by cpinkham

  • Milestone changed from 0.24 to unknown

comment:12 Changed 3 years ago by anonymous

I would prefer a different heuristic here. Rather than just blindly cropping, we should pad with letterboxing/pillarboxing if needed, and crop if possible.

ideally: we should strip off all letterboxing/pillarboxing, resize, transcode... then repad to the desired aspect ratio (per frame would be wonderful!), regardless of source aspect ratio. This way we don't waste valuable bits on encoding black bars, AND we don't lose the contents as we would in some cases with a blind cropping.

To do this would require intelligent cropping, and this would likely be slower than desirable though.

comment:13 Changed 3 years ago by beirdo

stupid chrome logged me off. That was me.

comment:14 Changed 15 months ago by stuartm

  • Version changed from head to Master Head
  • Type changed from enhancement to Patch - Feature
View

Add a comment

Modify Ticket

Action
as assigned
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.