如何为含Vorbis音频的OGG文件添加章节?FFmpeg报错求助
Let’s break down what’s going wrong here and get your chapters added properly.
The Root Problem
Your original command uses -i metadata_OGG.txt, which tells FFmpeg to treat your text metadata file as a media input stream instead of a metadata source. FFmpeg tries to parse the text file like an audio/video file, which obviously fails—hence the "Unsupported codec id" error.
The Corrected Command
Instead of using -i for your metadata file, use the -metadata_file parameter to load the chapter data correctly. Here’s the fixed command:
ffmpeg -threads auto -y -i in.ogg -metadata_file metadata_OGG.txt -codec copy out_METADATA.ogg
Double-Check Your Metadata Format
Great news—your metadata_OGG.txt structure is already valid for FFmpeg’s chapter handling. Just make sure each key-value pair is on its own line (this helps FFmpeg parse them reliably):
CHAPTER00=00:00:00.000 CHAPTER00NAME=Chapter 01 CHAPTER01=00:00:05.000 CHAPTER01NAME=Chapter 02 CHAPTER02=00:00:10.000 CHAPTER02NAME=Chapter 03
Quick Additional Tips
- Update FFmpeg: If you still hit snags, ensure you’re using a recent version of FFmpeg. Older builds had inconsistent support for OGG chapter metadata.
- Test Playback: Most modern players (like VLC) will recognize these chapters, but some lightweight OGG players might not—this is a player limitation, not an issue with your file.
内容的提问来源于stack exchange,提问作者MayurK

