class VideoAnalyzer
Ruby on Rails 7.0.10
Since v5.2.8.1Extracts the following from a video blob:
-
Width (pixels)
-
Height (pixels)
-
Duration (seconds)
-
Angle (degrees)
-
Display aspect ratio
-
Audio (true if file has an audio channel, false if not)
-
Video (true if file has an video channel, false if not)
Example:
ActiveStorage::Analyzer::VideoAnalyzer.new(blob).metadata # => { width: 640.0, height: 480.0, duration: 5.0, angle: 0, display_aspect_ratio: [4, 3], audio: true, video: true }
When a video’s angle is 90, -90, 270 or -270 degrees, its width and height are automatically swapped for convenience.
This analyzer requires the FFmpeg system library, which is not provided by Rails.
Inherits from
Methods (defined here)
Private methods
(21)
Implementation detail — not part of the public API.
- # angle
- # audio?
- # audio_stream
- # computed_height
- # container
- # display_aspect_ratio
- # display_height_scale
- # duration
- # encoded_height
- # encoded_width
- # ffprobe_path
- # height
- # probe
- # probe_from
- # rotated?
- # side_data
- # streams
- # tags
- # video?
- # video_stream
- # width
Methods (inherited)
From ActiveStorage::Analyzer (4)
- # metadata
- self. accept?
- self. analyze_later?
- self. new
From Object (16)
- # acts_like?
- # blank?
- # deep_dup
- # duplicable?
- # html_safe?
- # in?
- # instance_values
- # instance_variable_names
- # presence
- # presence_in
- # present?
- # to_param
- # to_query
- # try
- # try!
- # with_options
From ActiveRecord::TestFixtures (4)
From ActiveSupport::Concern (3)
- # class_methods
- # included
- # prepended