Fix h264 profile match

This commit is contained in:
DataHoarder 2021-11-21 16:37:46 +01:00
parent 4cb70e0604
commit 974c96631d

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name AnimeBytes Mediainfo Improvements
// @author WeebDataHoarder
// @version 1.6.0
// @version 1.6.1
// @downloadURL https://git.gammaspectra.live/WeebDataHoarder/userscripts/raw/branch/master/AnimeBytes/ab-mediainfo.user.js
// @updateURL https://git.gammaspectra.live/WeebDataHoarder/userscripts/raw/branch/master/AnimeBytes/ab-mediainfo.user.js
// @description AnimeBytes Mediainfo Improvements. Adds several listing and matching releases against mediainfo utilities. MIT license
@ -743,31 +743,6 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
}
}
if("encoding_settings" in video){
let match = null;
if((match = video.encoding_settings.match(/crf=(?<crf>[0-9.]+)/)) !== null){
tags.videoCRF = parseFloat(match.groups.crf).toFixed(1);
}
if(video.encoding_settings.match(/rc=2pass/) !== null){
tags.videoCRF = "2pass";
}
if((match = video.encoding_settings.match(/profile=(?<profile>baseline|main)/)) !== null){
warnings.video.push(["warning", "Found encode using profile=" + match.groups.profile + " on encoding settings"]);
}
if(video.encoding_settings.match(/cabac=0/) !== null){
warnings.video.push(["info", "Found encode with CABAC disabled"]);
}
if(video.encoding_settings.match(/mbtree=0/) !== null){
warnings.video.push(["info", "Found encode with mbtree disabled"]);
}
if(video.encoding_settings.match(/bframes=0/) !== null){
warnings.video.push(["info", "Found encode with bframes disabled"]);
}
if(video.encoding_settings.match(/me=dia/) !== null){
warnings.video.push(["info", "Found encode with me=dia"]);
}
}
//Detect probably H264 remuxes
try{
if(
@ -783,6 +758,31 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
}catch (e){
}
if("encoding_settings" in video){
let match = null;
if((match = video.encoding_settings.match(/crf=(?<crf>[0-9.]+)/)) !== null){
tags.videoCRF = parseFloat(match.groups.crf).toFixed(1);
}
if(video.encoding_settings.match(/rc=2pass/) !== null){
tags.videoCRF = "2pass";
}
if(!("remux" in tags) && video.codec_id === "V_MPEG4/ISO/AVC" && (match = video.format_profile.match(/(?<profile>(baseline|main)[ 0-9]*)@/i)) !== null){
warnings.video.push(["warning", "Found encode using profile=" + match.groups.profile + " on encoding settings"]);
}
if(video.encoding_settings.match(/cabac=0/) !== null){
warnings.video.push(["info", "Found encode with CABAC disabled"]);
}
if(video.encoding_settings.match(/mbtree=0/) !== null){
warnings.video.push(["info", "Found encode with mbtree disabled"]);
}
if(video.encoding_settings.match(/bframes=0/) !== null){
warnings.video.push(["info", "Found encode with bframes disabled"]);
}
if(video.encoding_settings.match(/me=dia/) !== null){
warnings.video.push(["info", "Found encode with me=dia"]);
}
}
}
mediainfo.audio.forEach((audio, index) => {