media assets: save more metadata for videos.
Include the following metadata tags for videos: * FFmpeg:MajorBrand (e.g. mp42) * FFmpeg:PixFmt (e.g. yuv420p. Indicates bit depth and color subsampling mode) * FFmpeg:FrameCount (e.g. total number of frames in the video) * FFmpeg:VideoCodec (e.g. h264) * FFmpeg:VideoProfile (e.g. Main) * FFmpeg:AudioCodec (e.g. AAC) * FFmpeg:AudioProfile (e.g. LC) * FFmpeg:AudioLayout (e.g. stereo) * FFmpeg:AudioBitRate (e.g. 128kb/s)
This commit is contained in:
@@ -83,6 +83,10 @@ class FFmpeg
|
||||
frame_count / duration
|
||||
end
|
||||
|
||||
def major_brand
|
||||
metadata.dig(:format, :tags, :major_brand)
|
||||
end
|
||||
|
||||
def pix_fmt
|
||||
video_stream[:pix_fmt]
|
||||
end
|
||||
@@ -99,6 +103,14 @@ class FFmpeg
|
||||
metadata[:streams].to_a.select { |stream| stream[:codec_type] == "video" }
|
||||
end
|
||||
|
||||
def audio_codec
|
||||
audio_stream[:codec_name]
|
||||
end
|
||||
|
||||
def audio_stream
|
||||
audio_streams.first || {}
|
||||
end
|
||||
|
||||
def audio_streams
|
||||
metadata[:streams].to_a.select { |stream| stream[:codec_type] == "audio" }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user