Created
July 6, 2021 16:52
-
-
Save zlovatt/c5f12937e6ea308b7fbc8ecc313dcc2d to your computer and use it in GitHub Desktop.
Extendscript: get audio file bitrate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This doesn't check that the selection is valid, or that it's an audio file. | |
// Based on: http://stackoverflow.com/questions/21634091/is-it-possible-to-get-bitrate-of-mp3 | |
(function () { | |
var item = app.project.selection[0]; | |
var duration = item.duration; | |
var fileSize = item.file.length; | |
var kbit = fileSize/128; | |
var kbps = Math.ceil(Math.round(kbit / duration) / 16) * 16; | |
$.writeln(kbps + " kbps"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment