-
Notifications
You must be signed in to change notification settings - Fork 2
Regarding How to Process Audio Files into Usable Ogg Format Files
Introduction: This tutorial uses FFmpeg. You can also use your preferred audio editor, but that is beyond the scope of this tutorial.
P1: Download and Configure FFmpeg
You can find tutorials on how to install FFmpeg on websites like YouTube,TikTok,Bilibili, which might be more helpful. Here, we'll use Windows as an example. If you only need to check the audio processing part of the tutorial, scroll down to P2.
1. Open FFmpeg's official download page, and find the download link for your operating system in "More downloading options" - "Get packages & executable files". You should click in the order shown below. The first link downloads slower, and the second link may not be accessible in some regions.

If you choose the first link, you should find "release builds" on the redirected page and choose one of "ffmpeg-release-full.7z" or "ffmpeg-release-full-shared.7z" to download.

If you choose the second link, you can directly see "ffmpeg-master-latest-win64-gpl.zip" and "ffmpeg-master-latest-win64-gpl-shared.zip" on the redirected page. Choose one to download.

2. Then, choose a location to extract and open the downloaded compressed file, and add the bin directory to the environment variable Path.
For example, if this is its directory:
You should right-click on "This PC", select "Properties", find "Advanced system settings" on the pop-up page, select "Environment Variables..." in the bottom right corner of the window, then find "Path" in the system variables, click and select Edit - New, enter the field "D:\ffmpeg\ffmpeg-master-latest-win64-gpl\bin", press Enter, and select "OK" twice and "Apply" once.

3. Now you have completed the installation of FFmpeg. Next, check P2 to edit your audio files.
P2: Processing Audio Files
1. First, find the directory where you store your audio files, click the address bar, type "cmd" and press Enter.

2. In the black window that pops up, enter the following code and press Enter to convert the file to ogg format.
ffmpeg -i your_filename output_filename.ogg

3. After the program finishes processing, check the cmd window to see if the ogg file contains a cover video stream.
Example:

Looking at the red line part, it is easy to find that Stream #0:0 is a video stream containing information about the song cover, which will prevent the game from correctly reading and playing the audio, while Stream #0:1 is the audio stream we need. Let's continue to extract the audio stream.
Enter the following code and press Enter to extract the audio stream Stream #0:1 into another file.
ffmpeg -i output_filename.ogg -map 0:1 -c copy output_audio_filename.ogg
In the previous example, we should do this:

After the program finishes processing, we have an audio file with only the audio stream.

4. Finally, you have a usable ogg format audio file that you can add to the game! (Remember that the file name should not contain characters other than lowercase letters, numbers, "-._")
5. Note: If you need stereo, distance attenuation, and other playback effects, you need to convert the audio file to mono. The operation is as follows:
ffmpeg -i input_filename.ogg -ac 1 output_filename.ogg
