]> zdv2.bktei.com Git - BK-2020-03.git/blob - unitproc/bkt-get_media_bitrate
fix(user/bk-copy-rand-music):Cap opus bitrate to 256k
[BK-2020-03.git] / unitproc / bkt-get_media_bitrate
1 #!/usr/bin/env bash
2
3 get_media_bitrate() {
4 # Use ffprobe to get audio/visual media container bitrate (bits per second integer)
5 # Usage: get_media_bitrate arg1
6 # Input: arg1: str path to file
7 # Output: stdout: int bitrate (bits per second)
8 # Version: 0.0.1
9 # Depends: ffprobe 4.4.2
10 # Ref/Attrib: [1] How to get video duration in seconds? https://superuser.com/a/945604
11 # [2] Determine video bitrate using ffmpeg https://superuser.com/questions/1106343/determine-video-bitrate-using-ffmpeg
12 local file_in
13 file_in="$1";
14 if [[ ! -f $file_in ]]; then
15 die "ERROR:Not a file:$file_in";
16 fi;
17 ffprobe -v error -show_entries format=bit_rate -of default=noprint_wrappers=1:nokey=1 "$file_in";
18 } # Get media container length in seconds via stdout
19
20 # Author: Steven Baltakatei Sandoval
21 # License: GPLv3+