480p in {vf} ?

All about user-defined episode / movie / file name format expressions
Post Reply
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

480p in {vf} ?

Post by roshambo »

What, if any, is the conditions for 480p in {vf}?

I would expect it to be >= 700 width but <= 860 unless height >= 576. The 860 comes from 720x480 16:9 ntsc dvd's being 854x480 with 1:1. pal dvd's are 1024x576 at 1:1.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

The condition:
https://sourceforge.net/p/filebot/code/ ... .java#l281

It's all about satisfying minimum conditions in video.height and video.width, and I've add the extra stops with r2200
:idea: Please read the FAQ and How to Request Help.
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

Re: 480p in {vf} ?

Post by roshambo »

I don't understand the code enough to figure it out but with the new code will it be something like this?

512x288, 448x336 = 240p
688x384, 640x272, 576x304, 512x384 = 360p
720x400, 704x480, 852x480, 640x480 = 480p
704x576, 960x560, 1024x576 =576p
960x720, 1024x768, 1280x544 = 720p

Where would 480x360 go?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

Here's the same logic in Groovy:

Code: Select all

def getVideoFormat(int width, int height){
	int ns = 0;
	def ws = [15360, 7680, 3840, 1920, 1280, 1024, 854, 854, 720, 720, 360, 240, 120]
	def hs = [8640, 4320, 2160, 1080, 720, 576, 576, 480, 576, 480, 360, 240, 120]
	for (int i = 0; i < ws.size() - 1; i++) {
		if ((width >= ws[i] || height >= hs[i]) || (width > ws[i + 1] && height > hs[i + 1])) {
			ns = hs[i];
			break;
		}
	}
	if (ns > 0) {
		// e.g. 720p, nobody actually wants files to be tagged as interlaced, e.g. 720i
		return String.format("%dp", ns);
	}
	return null; // video too small
}

[ 
[512,288], [448,336], [688,384], [640,272], [576,304], [512,384], [720,400], [704,480], [852,480], [640,480], [704,576], [960,560], [1024,576], [960,720], [1024,768], [1280,544]
].each{
	print it
	print '\t'
	println getVideoFormat(it[0], it[1])
}
This is how it works right now:

Code: Select all

[512, 288]	360p
[448, 336]	360p
[688, 384]	480p
[640, 272]	360p
[576, 304]	360p
[512, 384]	480p
[720, 400]	576p
[704, 480]	480p
[852, 480]	480p
[640, 480]	480p
[704, 576]	576p
[960, 560]	576p
[1024, 576]	576p
[960, 720]	720p
[1024, 768]	720p
[1280, 544]	720p

Code: Select all

[480, 360]	360p
Is there a standard or exact definition for what exactly 360p is, or 720p or whatever? Cause I don't see a pattern.
:idea: Please read the FAQ and How to Request Help.
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

Re: 480p in {vf} ?

Post by roshambo »

Not that I know of. They look ok except [720, 400] 576p sticks out. There's higher resolutions as 480p, which is what I'd expect.

448x336 I'd expect 240p. All widescreen under 512 width and fullscreen below 480x360 too.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

This should be the right stops that approximate things better:

Code: Select all

def ws = [15360, 7680, 3840, 1920, 1280, 1024, 854, 852, 688, 512, 320]
def hs = [ 8640, 4320, 2160, 1080,  720,  576, 576, 480, 360, 240, 240]
Here's the output:

Code: Select all

[480, 360]	360p
[512, 288]	240p
[448, 336]	240p
[688, 384]	360p
[640, 272]	360p
[576, 304]	360p
[512, 384]	360p
[720, 400]	480p
[704, 480]	480p
[852, 480]	480p
[640, 480]	480p
[704, 576]	576p
[960, 560]	576p
[1024, 576]	576p
[960, 720]	720p
[1024, 768]	720p
[1280, 544]	720p
:idea: Please read the FAQ and How to Request Help.
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

Re: 480p in {vf} ?

Post by roshambo »

Looks better, 512x288 is kind of tough. It sounds kind of low for 360p but 480z360 also sounds low but it's technically right. What do you think?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

Yeah, but it's shitty low-resolution and 288p definitely doesn't qualify for 360p. In absence of an actual standard it'll leave it like this. Looks good to me, and the 240p/360p issue doesn't matter anyway, it's not like anybody keeps those files around. As long as the higher resolutions work as expected all is good.
:idea: Please read the FAQ and How to Request Help.
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

Re: 480p in {vf} ?

Post by roshambo »

True, thanks for the quick response.
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

Re: 480p in {vf} ?

Post by roshambo »

One thing I've noticed is 720x304 shows as 360p. Shouldn't it be 480p?

Also how about detecting interlaced by mediainfo's 'Scan type: Interlaced' and appropriately naming them i instead of p?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

1.
Added step for 720x304 => 480p

2.
People don't understand p/i and get confused when they suddenly get 720i which most people have never seen before. The {vf} gives you the lies you wanna see. ;)

If you want the real values use:

Code: Select all

{hpi}
:idea: Please read the FAQ and How to Request Help.
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

Re: 480p in {vf} ?

Post by roshambo »

{hpi} works thanks! It's mainly to differ between hdtv 1080i and bluray 1080p in my case.

Well {hpi} works when it works which it failed on 6 of 10 files I just tried it on. {vf} works on the same files, any idea what's going on?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

I suppose the Progressive/Interlaced MediaInfo field isn't available for some files. You can check Video > ScanType field.
:idea: Please read the FAQ and How to Request Help.
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

Re: 480p in {vf} ?

Post by roshambo »

You're right, I'll try contacting mediainfo dev about it. In the meantime would it make sense to just put 1080 in such cases instead of nothing?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

No.

Besides, you have all the bindings, nothing stopping you from making your own implementations with your own error handling:

Code: Select all

{video.height}{video.scanType[0].toLowerCase()}
:idea: Please read the FAQ and How to Request Help.
roshambo
Posts: 11
Joined: 28 Apr 2014, 22:20

Re: 480p in {vf} ?

Post by roshambo »

That gives me odd heights on cropped video. Like 536p, 404p, etc.

I'll see if mediainfo can be corrected, otherwise might be able to come up with something that renames after filebot based on scan type.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

{hpi} literally does give you height + progressive/interlaced so it's not odd heights, it's the actual heights. Only {vf} tries to interpret and classify it into one of these standard formats.
:idea: Please read the FAQ and How to Request Help.
WasabiNME
Posts: 10
Joined: 16 Dec 2015, 00:25

Re: 480p in {vf} ?

Post by WasabiNME »

rednoah wrote: 25 Jun 2014, 02:56 1.
Added step for 720x304 => 480p

2.
People don't understand p/i and get confused when they suddenly get 720i which most people have never seen before. The {vf} gives you the lies you wanna see. ;)

If you want the real values use:

Code: Select all

{hpi}
So I just spent far too long trying to figure out why an interlaced file was spitting out a "p" when using {vf}. Any other functions you've written that don't work properly because you think your users are stupid?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 480p in {vf} ?

Post by rednoah »

1.
You can use the Image Change Sample button to quickly check all binding values for a given File / Object match. We have {vf} and {hpi} so that you choose the one that works best for your use case.

Image



2.
You can use the MediaInfo Inspector to see raw MediaInfo properties. If something seems off, for one reason or another, it's always worth going to the source and checking the raw MediaInfo properties to see what pieces of information the format engine is working with. Many bindings are work-in-progress, especially bindings related to HDR video and DD multi-channel audio, and may change over time as users suggest or request changes in behaviour.

Image
:idea: Please read the FAQ and How to Request Help.
Post Reply