Skip to content

freewind-demos/java-ffmpeg-convert-wav-to-mp3-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Convert wav to mp3 Demo

Use ffmpeg wrapper to convert wav file to mp3.

brew install ffmpeg

Check the path of ffmpeg:

$ which ffmpeg
/usr/local/bin/ffmpeg

Modify the path in Hello.java if not same.

Run Hello.java in your IDE.

Notice

mp3文件实际上有很多格式的,比如mp1, mp2, mp2.5, mp3等等

  1. 通常我们使用mp3格式:setFormat("mp3"),可以正常被各种播放器播放,它是默认值
  2. 但是,JavaFX不支持。所以要想让JavaFX正常播放,需要:.setFormat("mp2")
  3. 减小体积:setAudioCodec("libmp3lame")。如果不设置的话,会大几倍

这是花了几个小时研究出来的

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages