Você pode usar a ferramenta ffprobe
CLI incluída em ffmpeg
:
$ ffprobe -hide_banner 10\ Ivory\ Tower.flac
Input #0, flac, from '10 Ivory Tower.flac':
Metadata:
ARTIST : Van Morrison
TITLE : Ivory Tower
ALBUM : No Guru, No Method, No Teacher
DATE : 1986
track : 10
GENRE : Rock
disc : 1
TOTALDISCS : 1
TOTALTRACKS : 10
Duration: 00:03:36.71, start: 0.000000, bitrate: 946 kb/s
Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Mostra a duração, a taxa de bits e os detalhes sobre a codificação FLAC. ffmpeg/ffprobe
usa o termo streams, então o arquivo que fornecemos é considerado Stream#0:0
.
Você pode obter apenas esses detalhes:
$ ffprobe -hide_banner 10\ Ivory\ Tower.flac |& grep Stream
Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Ou, se você quiser realmente obter todos os dados do fluxo, use o -show_stream
:
$ ffprobe -hide_banner -show_streams 10\ Ivory\ Tower.flac
Input #0, flac, from '10 Ivory Tower.flac':
Metadata:
ARTIST : Van Morrison
TITLE : Ivory Tower
ALBUM : No Guru, No Method, No Teacher
DATE : 1986
track : 10
GENRE : Rock
disc : 1
TOTALDISCS : 1
TOTALTRACKS : 10
Duration: 00:03:36.71, start: 0.000000, bitrate: 946 kb/s
Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
[STREAM]
index=0
codec_name=flac
codec_long_name=FLAC (Free Lossless Audio Codec)
profile=unknown
codec_type=audio
codec_time_base=1/44100
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=s16
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=0
start_time=0.000000
duration_ts=9556764
duration=216.706667
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=16
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
Veja as referências abaixo para mais exemplos, etc.
Referências