Strange values for video format (vf)

Any questions? Need some help?
Post Reply
primo
Posts: 1
Joined: 08 Mar 2012, 16:23

Strange values for video format (vf)

Post by primo »

Hi, I started using FileBot yesterday. It is a very interesting application. Good job.
I have the following doubt: is there any way to force FileBot to use ' standard' video format {vf} values like 480p, 720p, and 1080p, instead of 368p, 544p, etc.? I really don't care about the exact value. I understand this is read from the file through mediainfo, right? Is there anyway to force it to choose from these 3 specific values?

Thanks
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Strange values for video format (vf)

Post by rednoah »

Before HD there wasn't really a standard for video resolution for rips...

Code: Select all

{sdhd == 'HD' ? vf : '480p'}
This'll continue to use the real video data {vf} for HD content, but just say "480p" for any non-HD content.
:idea: Please read the FAQ and How to Request Help.
Eterimos
Posts: 11
Joined: 29 Apr 2012, 08:10

Re: Strange values for video format (vf)

Post by Eterimos »

Hi,

thanks for this great tool first of all.

I agree with the OP that having 480p/720p/1080p would be more useful than the actual video resolution.
So this might be something like a vf category.

I don't see how I can achieve this with the format rules. Am I missing something?
It should be if (vf > 1000) use 1080p else if (vf > 700) use 720p else use 480p. (for example)
If it's possible please let us know.

Thanks
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Strange values for video format (vf)

Post by rednoah »

Sure, why wouldn't it?

Here you go:

Code: Select all

{def h = video.height as int; h > 1000 ? 1080 : h > 700 ? 720 : 480}p
:idea: Please read the FAQ and How to Request Help.
Eterimos
Posts: 11
Joined: 29 Apr 2012, 08:10

Re: Strange values for video format (vf)

Post by Eterimos »

Excellent! Just what I wanted.
Thank you very much!
plastiqueusa
Posts: 1
Joined: 01 May 2012, 00:28

Re: Strange values for video format (vf)

Post by plastiqueusa »

I just discovered Filebot today have got a slightly modified version of sortiva.groovy up and running, applying my preferred naming format. However, there are a couple of custom values I'd like to incorporate:

1. For video format calculation, reference the default value and round up to the nearest breakpoint (360p, 480p, 720p, 1080p).
2. For sd/hd calculation, reference the video format value and set as HD if higher than 480p; otherwise, SD.

I took a look at the snippets posted here and spent some time tweaking them and trying to incorporate them into the sortiva script, but in each case the script stopped working altogether. I can't quite figure out what's going wrong, so any help is appreciated.

Thanks
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Strange values for video format (vf)

Post by rednoah »

Make sure you don't break mess up the Groovy syntax. If it's format:'...' you can't use ' in you script.

vf category (very simple, not rounding anything):

Code: Select all

{def h = video.height as int; h > 1000 ? 1080 : h > 700 ? 720 : h > 400 ? 480 : 360}p
sdhd:

Code: Select all

{def h = video.height as int; h > 480 ? "HD" : "SD"}
Note: {sdhd} binding requires video.height >= 720

EDIT:
Here's a very non-math-heavy version of rounding up :P

Code: Select all

{for (h = video.height as int; h <= 1080; h++) {if ([1080, 720, 480, 360].contains(h)) return h}}
:idea: Please read the FAQ and How to Request Help.
larsser15
Posts: 6
Joined: 09 Feb 2012, 05:05

Re: Strange values for video format (vf)

Post by larsser15 »

So I feel that I'm only interested in 1080p and 720p, and anything less, I'll just call SD, so I came up with this slight modification.

Code: Select all

{def h = video.height as int; h >1000 ? "1080p" : h > 700 ? "720p" : h > 400 ? "480p" : "SD"}
Code wise, I've only dabbled in Visual Basic, so I'm a newb. :ugeek:
Eterimos
Posts: 11
Joined: 29 Apr 2012, 08:10

Re: Strange values for video format (vf)

Post by Eterimos »

FYI I found the following thresholds more useful because you may have 1080p with cropped black bars, so less than 1000 vertical pixels but it should still be considered 1080p in the file naming.

Code: Select all

{def h = video.height as int; h > 720 ? 1080 : h > 480 ? 720 : 480}p
These are the naming schemes for series and movies I'm using.

Code: Select all

{n.space('.')}.{'S'+s.pad(2)}E{e.pad(2)}.{t.space('.')}.{def h = video.height as int; h > 720 ? 1080 : h > 480 ? 720 : 480}p{".$source"}{".$vc"}{"-$group"}

{n.space('.')}.{y}.{def h = video.height as int; h > 720 ? 1080 : h > 480 ? 720 : 480}p{".$source"}{".$vc"}{"-$group"}
tonkatsu
Posts: 3
Joined: 15 Mar 2013, 19:42

Re: Strange values for video format (vf)

Post by tonkatsu »

I've got a movie with a resolution of : 1280X534. It's supossed to be 720p, but if i only evaluate the height (534<700) it cannot be considered 720p.... maybe the width can be a important variable?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Strange values for video format (vf)

Post by rednoah »

tonkatsu wrote:I've got a movie with a resolution of : 1280X534. It's supossed to be 720p, but if i only evaluate the height (534<700) it cannot be considered 720p.... maybe the width can be a important variable?
Fixed with r1551.
:idea: Please read the FAQ and How to Request Help.
Northys
Posts: 1
Joined: 04 Nov 2013, 17:25

Re: Strange values for video format (vf)

Post by Northys »

I think that this is the best solution, because a lot of movies aren't 16:9 (1920x1080) but the height is smaller so I started to use width to get the "p" quality:

Code: Select all

{def w = video.width as int; w > 1900 ? "1080p" : w > 1200 ? "720p" : "SD"}
1900px and more width = 1080p
1200px and more width = 720p
the others = SD
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Strange values for video format (vf)

Post by rednoah »

Looks good!

With newer versions you can write it like this:

Code: Select all

{dim[0] > 1900 ? "1080p" : dim[0] > 1200 ? "720p" : "SD"}
:idea: Please read the FAQ and How to Request Help.
gregsterb
Posts: 4
Joined: 20 Apr 2017, 17:46

Re: Strange values for video format (vf)

Post by gregsterb »

Does this actually pull the data from the video file to give it the name? I made a large mistake and renamed my entire collection to this format "The Book of Life 2014 [Romance, 7.3, PG]". Now I wish I had of include more information on the video type.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Strange values for video format (vf)

Post by rednoah »

Yes. The only source for that kind of information is the file itself.

You can make a Plain File Preset to add some extra information to the file name with a format such as this:

Code: Select all

{fn} {[vf, vc, ac]}
:idea: Please read the FAQ and How to Request Help.
Post Reply