Skip to content

Instantly share code, notes, and snippets.

View zhuker's full-sized avatar
🏠
Working from home

Alex Zhukov zhuker

🏠
Working from home
View GitHub Profile
@zhuker
zhuker / PerfectBrickTest.java
Last active December 27, 2017 02:42
EulerBrick brute force
package com.vg.ts;
import static org.junit.Assert.assertTrue;
import java.util.stream.LongStream;
import org.junit.Test;
//http://mathforum.org/dr.math/faq/formulas/faq.parallelepiped.html
//https://stackoverflow.com/questions/15212533/java-square-root-integer-operations-without-casting

precomputed.js

public class FnMediaNeighbors {
    /** neighbor count per frame */
    public int[] neighbors;
    /** best matching frame/media pairs */ 
    public List<List<BestFrames>> bestFrames;
}

public class BestFrames {
#!/bin/sh
palette="/tmp/palette.png"
filters="fps=15,scale=270:-1:flags=lanczos"
ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$2"
@zhuker
zhuker / diff.txt
Last active November 22, 2018 23:17
This is an important
notice! It should
therefore be located at
the beginning of this
document!
This part of the
document has stayed the
same from version to
version. It shouldn't
convert png.png -background white -flatten jpg.jpg
/**
* Compare two {@code double} values
* @param other <i>double</i> value to compare to
* @param epsilon precision
* @return {@code true} if the two values are equal
*/
fun Double.eq(other: Double, epsilon: Double = 0.00000001) = Math.abs(this - other) < epsilon
fun Float.eq(other: Float, epsilon: Float = 0.00000001f) = Math.abs(this - other) < epsilon
input=$1
ffprobe -v quiet -print_format json -show_format -show_streams $input
ffmpeg -i input30i.mov -vf fieldmatch=combmatch=full,yadif=deint=interlaced,decimate -vcodec prores -r 24000/1001 output24p.mov
ffmpeg -i input.mov -pix_fmt rgb24 -start_number 0 -f image2 -compression_level 0 -y 'outputdir/%06d.png'
ls stream-0.* | sort -n -k 2 -t '.' | xargs cat >../output.mp4