Skip to content

Instantly share code, notes, and snippets.

@tigrouind
tigrouind / main.py
Created August 1, 2022 21:55
Synchronize subtitles of a given movie based on another movie
import cv2
import numpy
import math
import srt
import datetime
vidA = cv2.VideoCapture('movieA.mkv') #reference
vidB = cv2.VideoCapture('movieB.mkv') #to synchronize
with open('subtitles.srt', 'r') as f: #from fileA.mkv
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace Test
{
class Program
{
static Random rand = new Random();
@tigrouind
tigrouind / sort.js
Last active March 5, 2019 14:48
move duplicate items next to each other
function sort(a) {
var n = a.length;
for (var j = 0; j < n - 2; j++) {
for (var i = j + 1; i < n; i++) {
if (a[i] == a[j]) {
//swap
if (a[i] != a[j + 1]) {
var tmp = a[j + 1];
a[j + 1] = a[i];
a[i] = tmp;