This commit is contained in:
artemis 2019-09-11 15:18:51 -07:00
parent 14a36a18c5
commit a4d439922f
3 changed files with 40 additions and 0 deletions

13
bin/from-chroma Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env ruby
if ARGV.length < 1
STDERR.puts "Usage: #{__FILE__} [ffmpeg_args] <output> < command"
STDERR.puts ARGV.length.to_s
exit 1
end
resolution = STDIN.read(8).unpack("L>L>")
width = resolution[0]
height = resolution[1]
exec("ffmpeg", "-v", "error", "-f", "rawvideo", "-pix_fmt", "argb", "-s", "#{width}x#{height}", "-i", "-", *ARGV)

16
bin/to-chroma Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env ruby
if ARGV.length != 1
STDERR.puts "Usage: #{__FILE__} <input> | command"
STDERR.puts ARGV.length.to_s
exit 1
end
resolution = IO.popen(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=width,height", "-of", "default=noprint_wrappers=1:nokey=1", ARGV[0]]).read.split.map{ |x| x.to_i }
STDOUT.write(resolution.pack("L>L>"))
STDOUT.flush
exec("ffmpeg", "-v", "error", "-i", ARGV[0], "-f", "rawvideo", "-pix_fmt", "argb", "-")

11
spec Normal file
View File

@ -0,0 +1,11 @@
filters and generator should accept and produce sequences of images. Each sequence has the following format:
width unsigned 4 bytes big-endian
height unsigned 4 bytes big-endian
followed by one or more arrays of pixels:
pixels array of 4 byte big-endian ARGB pixels, width * height in length
pixel_index(x, y) = x + y * width
if a filter does not use alpha in any way it's best practice to copy the input alpha to the output.