Last active
January 15, 2018 14:27
-
-
Save suzumura-ss/1c89d7d001e8c7c0026dcda2fc7c3728 to your computer and use it in GitHub Desktop.
MotionJPEG to MP4
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
# ruby mjpeg.rb & | |
# ffmpeg -f mjpeg -r 30 -i tcp://127.0.0.1:8888 \ | |
# -c:v libx264 -profile:v baseline -pix_fmt yuv420p -y output.mp4 | |
require 'socket' | |
image = File.open('image.jpg', 'rb'){|fd| fd.read} | |
server = TCPServer.new("127.0.0.1", 8888) | |
sock = server.accept | |
(30*600).times do | |
sock.write image | |
end | |
sock.close | |
server.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment