Created
January 15, 2018 14:58
-
-
Save suzumura-ss/6f06ed0ad5b34ac257aaff36f0094a17 to your computer and use it in GitHub Desktop.
raw-YUV to MP4 with pipe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command = "ffmpeg -f rawvideo -pix_fmt yuv444p -color_range 2 -s:v 160x120 -r 30 -i pipe:0 " | |
+ "-c:v libx264 -profile:v baseline -pix_fmt yuv420p -y output.mp4" | |
IO.popen(command, "r+"){|io| | |
io.close_read | |
100.times do | |
(0..255).map{|y| | |
image = ([y].pack("C")) * 160 * 120 | |
image += ([127].pack("C")) * 160 * 120 | |
image += ([127].pack("C")) * 160 * 120 | |
15.times do | |
io.write image | |
end | |
} | |
end | |
io.close | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment