ffmpeg
Version, currently 1.3.121 versions
- 1.3.1latestJul 30, 2024
- 1.3.0not indexedJul 30, 2024
- 1.2.1not indexedJul 30, 2024
- 1.2.0not indexedJul 30, 2024
- 1.1.0not indexedJul 30, 2024
- 1.0.0not indexedJul 30, 2024
- 0.7.2not indexedJul 30, 2024
- 0.7.1not indexedJul 30, 2024
- 0.7.0not indexedJul 30, 2024
- 0.6.1not indexedJul 30, 2024
- 0.6.0not indexedJul 30, 2024
- 0.5.1not indexedJul 30, 2024
- 0.5.0not indexedJul 30, 2024
- 0.4.4not indexedJul 30, 2024
- 0.4.3not indexedJul 30, 2024
- 0.4.2not indexedJul 30, 2024
- 0.4.1not indexedJul 30, 2024
- 0.4.0not indexedJul 30, 2024
- 0.3.0not indexedJul 30, 2024
- 0.2.0not indexedJul 30, 2024
- 0.1.0not indexedJul 30, 2024
github.com/spider-gazelle/ffmpeg
ffmpeg crystal bindings
23 stars
3 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
ffmpeg:
github: spider-gazelle/ffmpeg
version: ~> 1.3.1Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Stephen von Takach
Dependencies
Runtime Dependencies
- ipaddress*github: Sija/ipaddress.cr
- stumpy_core*github: stumpycr/stumpy_core
Development Dependencies
- ameba*github: veelenga/amebadev
- stumpy_png*github: stumpycr/stumpy_pngdev
- stumpy_resize*github: spider-gazelle/stumpy_resizedev
README
ffmpeg 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-devsudo apt install libav-toolsorsudo apt install ffmpeg
Usage
parsing a video file, outputs StumpyCore Canvas
require "ffmpeg"
video = Video::File.new("./test.mp4")
video.each_frame do |frame|
puts "key frame? #{frame.key_frame?}"
frame # => FFmpeg::Frame
frame.to_canvas # => 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|
frame # => FFmpeg::Frame
frame.to_canvas # => StumpyCore::Canvas
end
You can also scale the frames
require "ffmpeg"
video = Video::File.new("./test.mp4")
# the scaler context
scaler = uninitialized FFmpeg::SWScale
# scaled frame we'll use for storing the scaling output
scaled_frame = uninitialized FFmpeg::Frame
video.on_codec do |codec|
# scale by 50%
width = codec.width // 2
height = codec.height // 2
scaler = FFmpeg::SWScale.new(codec, width, height, codec.pixel_format)
scaled_frame = FFmpeg::Frame.new width, height, codec.pixel_format
end
video.each_frame do |frame|
scaler.scale frame, scaled_frame
# do something with the scaled frame
scaled_frame.to_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
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.3.1- Tagged
- Jul 30, 2024
- Commit
a026cd65394b- Indexed
- yes
Dependents
Repository
github.com/spider-gazelle/ffmpeg
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 24, 2026
- Synced
- Sep 24, 2026
- Versions
- 21