ffmpeg libav bindings for crystal lang
Primarily to extract video frames from streams and files for processing by AI.
Installation
-
Add the dependency to your
shard.yml
:dependencies: ffmpeg: github: spider-gazelle/ffmpeg
-
Run
shards install
-
ensure the required libraries are installed
sudo apt install libswscale-dev
sudo apt install libav-tools
orsudo apt install ffmpeg
Usage
parsing a video file, outputs StumpyCore Canvas
require "ffmpeg"
video = Video::File.new("./test.mp4")
video.each_frame do |frame, is_key_frame|
frame # => StumpyCore::Canvas
end
also supports UDP streams (unicast or multicast)
require "ffmpeg"
video = Video::UDP.new("udp://239.0.0.2:1234")
video.each_frame do |frame, is_key_frame|
frame # => StumpyCore::Canvas
end
See the specs for more detailed usage
Contributing
- Fork it (https://github.com/spider-gazelle/ffmpeg/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Stephen von Takach - creator and maintainer