Software⏱️ 3 min read📅 2026-06-15

How to Fix: Fix audio codec error with ffmpeg

Fix audio codec error with ffmpeg to play AVI file in multiple media players.

Quick Answer: Use the -map_chapters option to specify the correct audio channel, e.g. -map_chapters 'v:0,a:1' to map video to stream #0 and audio to stream #1.

The issue of an audio codec error with ffmpeg occurs when removing an audio channel from an AVI file using ffmpeg, resulting in a file that can be played by some media players but not others. This error is frustrating because it prevents the user from easily editing or manipulating their audio files.

However, this problem can be fixed by identifying and correcting the issue with the audio codec information stored in the file.

🛑 Root Causes of the Error

  • The primary reason for this error is that ffmpeg does not write the original audio codec information to the output file. This results in the audio codec being set as 'Unknown' when played back with other media players.
  • An alternative reason could be a problem with the specific audio codec used, such as AC3/48000Hz and 6 channels, which may not be supported by all media players.

✅ Best Solutions to Fix It

Re-encode the file with the original audio codec information

  1. Step 1: Use ffmpeg to re-encode the output file with the original audio codec information using the following command: `ffmpeg -i -c:a ac3 -b:a 384k -ar 48000 -ac 6 `
  2. Step 2: This will ensure that the audio codec information is correctly written to the file, allowing it to be played back with all media players.
  3. Step 3: Note: The above command assumes that the original audio codec was AC3/48000Hz and 6 channels. Adjust the command accordingly if the original codec is different.

Use a tool like avidemux to set the audio codec information manually

  1. Step 1: Use avidemux to open the output file and select the correct audio codec (AC3/48000Hz and 6 channels) from the 'Audio' tab.
  2. Step 2: Save the changes made in avidemux back to the original file, this will overwrite the original file.

💡 Conclusion

By following one of these methods, you should be able to fix the audio codec error with ffmpeg and play the file correctly with all media players.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions