简体   繁体   English

音频可视化器中的那些条到底是什么? 需要借助 ffmpeg 制作可视化工具

[英]What are those bars in audio visualizer exactly? Need to make visualizer with help of ffmpeg

I'm trying to understand what are those bars in audio visualizers exactly.我试图确切地了解音频可视化器中的那些条。

音频可视化器

I tried to decode a mp3 file using ffmpeg like this:我尝试使用 ffmpeg 像这样解码 mp3 文件:

ffmpeg -i music.mp3 -t 1 -f s8 -acodec pcm_s8 -ar 1 out_1sec_sr1.raw

The output of this command is raw data of first second of the music.mp3 in 1hz samplerate.该命令的 output 是 music.mp3 的第一秒的原始数据,采样率为 1hz。 But the output file contains just 2 bytes... one for the left channel and one for the right channel?但是 output 文件只包含 2 个字节……一个用于左声道,一个用于右声道? I'm pretty sure that it is not possible to visualize a second of a music using only two bytes?我很确定不可能仅使用两个字节来可视化一秒钟的音乐? I guess each bar in below picture is at least one byte.我猜下图中的每个条至少是一个字节。 Am I missing something in ffmpeg command?我在 ffmpeg 命令中遗漏了什么吗? Is pcm_s8 codec appropriate for getting such data to visualize audio at all? pcm_s8 编解码器是否适合获取此类数据以可视化音频?

I'm using this library in my android project to use ffmpeg: https://github.com/brarcher/ffmpeg-android-java我在我的 android 项目中使用这个库来使用 ffmpeg: https://github.com/brarcher/ffmpeg-android-java

I do not have any problem in drawing those bars and reading raw data file from storage using inputStream.我在绘制这些条形图和使用 inputStream 从存储中读取原始数据文件时没有任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM