Git Product home page Git Product logo

bitrate's Introduction

bitrate

Calculates the bitrate given a file's size and duration

Build Status

example

var bitrate = require('bitrate')

var bytes = 6076940
var seconds = 149

var kilobitsPerSecond = bitrate(bytes, seconds) // => 326.3
var bitsPerSecond = bitrate(bytes, seconds, 'bps') // => 326279
var BytesPerSecond = bitrate(bytes, seconds, 'Bps') // => 40785

api

var bitrate = require('bitrate')

var rate = bitrate(bytes, seconds, [format])

  • bytes is a number of bytes
  • seconds is a number of the duration in seconds
  • format is a string of the desired format. Accepts:
    • bps, b/s; bits per second
    • kbps, kb/s; kilobits per second default
    • mbps, mb/s; megabits per second
    • Bps, B/s; bytes per second
    • KBps, KB/s; kilobytes per second
    • MBps, MB/s; megabytes per second
  • Returns rate number

install

With npm do:

npm install bitrate

license

VOL

bitrate's People

Contributors

artskydj avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sandalsoft

bitrate's Issues

Add 1024/1000 option (KB vs KiB)

Sorta like ffmpeg does:

https://ffmpeg.org/ffmpeg.html#Options


All the numerical options, if not specified otherwise, accept a string representing a number as input, which may be followed by one of the SI unit prefixes, for example: ’K’, ’M’, or ’G’.

If ’i’ is appended to the SI unit prefix, the complete prefix will be interpreted as a unit prefix for binary multiples, which are based on powers of 1024 instead of powers of 1000. Appending ’B’ to the SI unit prefix multiplies the value by 8. This allows using, for example: ’KB’, ’MiB’, ’G’ and ’B’ as number suffixes.

Options which do not take arguments are boolean options, and set the corresponding value to true. They can be set to false by prefixing the option name with "no". For example using "-nofoo" will set the boolean option with name "foo" to false.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.