ffmpeg audio format conversion, synthesis, rate adjustment

1. Audio format conversion

#ffmpeg -i 要转文件的绝对路径 输出文件绝对路径
ffmpeg -i /usr/local/file/1610559296433.amr /usr/local/file/out.mp3

 Implementation process

2. Audio rate conversion

Now we have a 17s audio and want to convert it to 20s.

Atmpo=17/20 Everyone studies the other parameters in the middle, and it is recommended to perform rate conversion of the same format audio, such as: mp3 to mp3. For different formats such as amr to mp3, first use amr to mp3 to get the mp3 time, compare with the target time, and perform rate conversion (amr to mp3 time is unstable).

ffmpeg -i /usr/local/file/out.mp3 -ab 32k -f mp3 -filter:a "atempo=0.85" /usr/local/file/out2.mp3

Three, audio synthesis

ffmpeg -i "concat:/usr/local/file/1610584814564t.mp3|/usr/local/file/1610584832504t.mp3|/usr/local/file/1610584848537t.mp3" -acodec copy /usr/local/file/83511610584848723.mp3

Four, java get audio duration and execute commands under linux

1. Get audio duration: https://blog.csdn.net/qq_29752857/article/details/112596878

2. Execute command under linux: https://blog.csdn.net/qq_29752857/article/details/112465221

Guess you like

Origin blog.csdn.net/qq_29752857/article/details/112598806