dimanche 11 juin 2023

FFMPEG gem is not generate correct bitrate value for a video in rails

I am using FFMPEG gem in rails, and I want to store bitrate value for a video in a table

I put this code in utility library/module

movie = FFMPEG::Movie.new(path)
media_detail = {duration: movie.duration, bitrate: movie.bitrate, resolution: movie.resolution}

On the show page I am using number_to_human_size rails helper method for more understandable representation

number_to_human_size(convert_kilobyte_to_byte(file.bitrate))

def convert_kilobyte_to_byte(bitrate_value)
     (bitrate_value.to_i*125)
end

FFMPEG gem generates everything as expected but in bitrate there is some problem and i really don't know why

Aucun commentaire:

Enregistrer un commentaire