How to: detect CBR or VBR With Bitrate. (Resolved)


#1

Hello,
I search a solution for create a [VBR] directory, I read Script Help with Adding Bitrate to Folder and it work for CBR:

$set(BitrateDir,$if($eq(%_bitrate%,320.0),
$set(_numbr,$div(%_bitrate%,1000))
$set(_folderbr,320),
$if($eq(%_bitrate%,256.0),$set(_folderbr,256),
$if($eq(%_bitrate%,192.0),$set(_folderbr,192),
$if($eq(%_bitrate%,160.0),$set(_folderbr,160),
$if($eq(%_bitrate%,128.0),$set(_folderbr,128),
$if($eq(%_bitrate%,64.0),$set(_folderbr,64)))))))
$if(%_folderbr%,,
$if($gte(%_numbr%,220),$set(_folderbr,V0),
$if($lt(%_numbr%,220),$set(_folderbr,V2),
$set(_folderbr,Err)
)))
$if($eq($upper(%_extension%),MP3),/[%_folderbr%K - %_sample_rate% %_channels%]))

But with a VBR i have this:
Capture%20d'%C3%A9cran%20de%202018-06-09%2018-53-23

[Err…]
BUT I noticed that VBR always used two values:

Summary

Ministry.MP3 (VBR)
Capture%20d'%C3%A9cran%20de%202018-06-09%2018-56-33
Capture%20d'%C3%A9cran%20de%202018-06-09%2019-06-32

Tal.MP3 VBR
Capture%20d'%C3%A9cran%20de%202018-06-09%2018-58-40
Capture%20d'%C3%A9cran%20de%202018-06-09%2019-08-03

Meshuggah.MP3 CBR
Capture%20d'%C3%A9cran%20de%202018-06-09%2019-00-33
Capture%20d'%C3%A9cran%20de%202018-06-09%2019-09-08

etc…

How to create variables to detect vbr like this?:
If not (0 after 320.), it’s VBR
Thank you.

Edit: To detect CBR:

$set(BRType,$if($eq_any(%_bitrate%,320.0,256.0,192.0,128.0,64.0),CBR))
$set(BitrateNumber4,
$if($eq(%_bitrate%,320.0),$set(_folderbr,320K),
$if($eq(%_bitrate%,256.0),$set(_folderbr,256K),
$if($eq(%_bitrate%,192.0),$set(_folderbr,192K),
$if($eq(%_bitrate%,160.0),$set(_folderbr,160K),
$if($eq(%_bitrate%,128.0),$set(_folderbr,128K),
$if($eq(%_bitrate%,64.0),$set(_folderbr,64K),
$if($gte(%_bitrate%,220.*),$set(_folderbr,VBRV0),
$if($lt(%_bitrate%,220.*),$set(_folderbr,VBRV2),))))))))
$if($eq($upper(%_extension%),MP3),/[MP3] [%_folderbr% - %_sample_rate% %_channels%][%BRType%]))

$if2(%albumartist%,%artist%)/$if($ne(%albumartist%,),%album%%BitrateNumber4%/)$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%

Output:
Capture%20d'%C3%A9cran%20de%202018-06-09%2020-13-39

Edit2:
Solution:

$set(BRType,$if($eq_any(%_bitrate%,320.0,256.0,192.0,128.0,64.0),CBR,VBR))

Output:
Capture%20d'%C3%A9cran%20de%202018-06-09%2021-39-51
Enjoy!


#2

Update:
I have cleaned the code

$noop(If bitrate=xxx.0 i'ts CBR, if bitrate=xxx.123, it's VBR)
$set(BRType,$if($eq_any(%_bitrate%,320.0,256.0,192.0,128.0,64.0),CBR,VBR))
$noop(If it's VBR, What is the bitrate?)
$if($eq(%BRType%,VBR),$set(BrVBR,$left(%_bitrate%,3)))

$set(BitrateNumber0,
$noop(
Disabled)
)
$set(BitrateNumber1,
$if($eq(%BRType%,CBR),
$if($eq(%_bitrate%,320.0),$set(_folderbr,320K),
$if($eq(%_bitrate%,256.0),$set(_folderbr,256K),
$if($eq(%_bitrate%,192.0),$set(_folderbr,192K),
$if($eq(%_bitrate%,160.0),$set(_folderbr,160K),
$if($eq(%_bitrate%,128.0),$set(_folderbr,128K),
$if($eq(%_bitrate%,64.0),$set(_folderbr,64K))))))),)
$noop(https://wiki.hydrogenaud.io/index.php?title=LAME#Recommended_settings_details)
$if($eq(%BRType%,VBR),
$if(%_folderbr%,,
$if($gte(%BrVBR%,220),$set(_folderbr, V0),
$if($lt(%BrVBR%,220),$set(_folderbr, V2),
))))
$if($eq($upper(%_extension%),MP3),/%_folderbr%$if($eq(%BRType%,CBR), [%_sample_rate%]%_channels%) %BRType%))

How to detect VBR V1;V3;v4;V5 and V6?

Source


source of script