Page 1 of 1

{vbr} not working in CLI but working in GUI

Posted: 02 Oct 2022, 14:04
by Kelsig
CLI sys-info: https://snipboard.io/5LvkAr.jpg

So I reorganized my file naming scheme to specify approximate video quality in title using the following script

Code: Select all

{
    if (((vbr > 30e6) && (hd==/UHD/)) || ((vbr > 10e6) && (hd==/HD/))) 
        'Movies Remux' 
    else
        {vc =~ /HEVC|265/ ? 'Movies H.265' : 'Movies H.264'}
}
{'/!!! HARD-LINKED'}/{plex[1]}{'/'}
{ny}{allOf
	{tags.join(', ')}
	{vs =~ /BluRay/ ? null : vs}
	{allOf
		{vf}
		{hdr.replace('Dolby Vision', 'DV')}
		{vc.replace('AVC','x264').replace('HEVC','x265')}
		{vbr.replace(' Mbps', 'mbps')}               <-------------- problem code
		.joining(' ', '', '')}
	{audio.title =~ /(?i)Commentary/ ? 'Commentary' : null}
	{group}
	.joining('] [', ' [', ']')}
{if (f.subtitle) {subt}}
And it is working just fine in the GUI

Image

Yet for whatever reason, in the CLI, with the same code in the .groovy file, it's just skipping past the line specified.

Image

Code: Select all

{vbr.replace(' Mbps', 'mbps')}
Really stumped on this.

Re: {vbr} not working in CLI but working in GUI

Posted: 02 Oct 2022, 14:45
by rednoah
vbr is not a String type object, so String.replace() won't work.


:arrow: You can do String.replace() but you need to convert the vbr object to a String value first:

Code: Select all

vbr.toString().replace(' Mbps', 'mbps')


EDIT:

Newer revisions add AutoScaleInteger.replace(a, b) that simply does toString().replace(a, b) internally. The format engine always works the same for both GUI and CLI, but you might be using different FileBot versions if you really do get different results.

Re: {vbr} not working in CLI but working in GUI

Posted: 02 Oct 2022, 15:32
by Kelsig
rednoah wrote: 02 Oct 2022, 14:45 vbr is not a String type object, so String.replace() won't work.


:arrow: You can do String.replace() but you need to convert the vbr object to a String value first:

Code: Select all

vbr.toString().replace(' Mbps', 'mbps')


EDIT:

Newer revisions add AutoScaleInteger.replace(a, b) that simply does toString().replace(a, b) internally. The format engine always works the same for both GUI and CLI, but you might be using different FileBot versions if you really do get different results.
Thank you, that fixed it. And now that you mention it I think my ubuntu/CLI version is not updated but GUI is.

Re: {vbr} not working in CLI but working in GUI

Posted: 03 Oct 2022, 16:12
by Kelsig
So I realized some file's mediainfo doesn't have video stream bitrate for whatever reason, and I have added overall bitrate fallback logic, but is there a way to alternatively derive video stream bitrate when not specified in mediainfo?

Re: {vbr} not working in CLI but working in GUI

Posted: 03 Oct 2022, 16:40
by rednoah
Does MediaInfo give you the size of the video stream? If yes, then divide by video duration. If no, then out of luck.
viewtopic.php?t=4285