Skip to content

Instantly share code, notes, and snippets.

@BubuInc
Created August 28, 2018 19:22
Show Gist options
  • Save BubuInc/888fdd9acf7fb2990b6235169cf113fd to your computer and use it in GitHub Desktop.
Save BubuInc/888fdd9acf7fb2990b6235169cf113fd to your computer and use it in GitHub Desktop.
fix start time of detected scenes from video in AVS Video Editor
<!DOCTYPE html>
<html>
<head>
<title>fix start time of detected scenes from video in AVS Video Editor</title>
<style type="text/css">
body {background-color: #f2f2f2; margin: 20px; font-family: Open Sans; font-size: 20px;}
input, button {font-family: Calibri; font-size: inherit;}
label, input[type="radio"] {cursor: pointer;}
</style>
</head>
<body>
<span>It adds 40 ms to every scene in timeline</span><br><br>
<span>Select vps project</span><br><br>
<input type="file" id="file"><br><br>
<button id="goBtn">Fix start time</button>
<script type="text/javascript">
function Id(el) { return document.getElementById(el); }
var fileEl = Id('file');
Id('goBtn').onclick = function () {
if (!fileEl.files.length) { fileEl.click(); return;}
read();
};
fileEl.onchange = function () {
if (!fileEl.files.length) {return;}
read();
}
function read() {
var reader = new FileReader();
reader.onload = function () {
fixStartTime(this.result);
};
reader.readAsBinaryString(fileEl.files[0].slice());
}
function fixStartTime(str) {
var out = str.replace(/sourcebegin="(.+?)"/g, function(match, contents, offset, input_string) {
return 'sourcebegin="'+(parseInt(contents)+41)+'"';
});
console.log(out);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment