Opened 13 years ago

Closed 2 years ago

#2581 closed Patch - Feature (Abandoned)

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 (5)

aspectRatio.patch (10.8 KB) - added by wagspat@… 13 years ago.
example patch that implements aspect ratio setting on mpeg4 transcoders
aspectRatio-0-20-2.patch (10.2 KB) - added by wagspat@… 12 years ago.
updated version of the patch for 0.20.2
aspectRatio-0-20-2.a.patch (10.1 KB) - added by patrick@… 12 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@… 11 years ago.
patch against 0.21-fixes, revision #18812
2581_aspectRatio-trunk.patch (17.4 KB) - added by cpinkham 10 years ago.
Aspect Ratio patch modified to work with trunk & with deinterlacing ability

Download all attachments as: .zip

Change History (20)

Changed 13 years ago by wagspat@…

Attachment: aspectRatio.patch added

example patch that implements aspect ratio setting on mpeg4 transcoders

comment:1 Changed 13 years ago by cpinkham

Owner: changed from Isaac Richards to cpinkham

Changed 12 years ago by wagspat@…

Attachment: aspectRatio-0-20-2.patch added

updated version of the patch for 0.20.2

comment:2 Changed 12 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 12 years ago by patrick@…

Attachment: aspectRatio-0-20-2.a.patch added

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

comment:3 Changed 12 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 12 years ago by cpinkham

Milestone: 0.210.22
Version: 0.20head

Changed 11 years ago by patrick@…

patch against 0.21-fixes, revision #18812

comment:5 Changed 11 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 11 years ago by Dibblah

Status: newassigned

comment:7 Changed 10 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 10 years ago by cpinkham

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

comment:8 Changed 10 years ago by cpinkham

Milestone: 0.220.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 10 years ago by stuartm

Component: mythtvMythTV - Mythtranscode

comment:10 Changed 10 years ago by cpinkham

Milestone: 0.230.24

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

comment:11 Changed 10 years ago by cpinkham

Milestone: 0.24unknown

comment:12 Changed 9 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 9 years ago by beirdo

stupid chrome logged me off. That was me.

comment:14 Changed 8 years ago by stuartm

Type: enhancementPatch - Feature
Version: headMaster Head

comment:15 Changed 2 years ago by Peter Bennett

Resolution: Abandoned
Status: assignedclosed

Closing this as abandoned.

In case somebody want to reopen it - I would prefer to see automatic cropping as is done by HandBrake?, for example. Using a manual method as described here could result in incorrect transcodes if the option is not correctly applied.

Note: See TracTickets for help on using tickets.