ffmpeg Decodes .xma Too Fast? by Kurausukun at 4:34 AM EST on December 10, 2016
I just tried using the latest build of ffmpeg to decode an .xma file (specifically, an .xma file from Sonic 06, which uses xma1), and ffmpeg does successfully output the file, but it plays too fast. Does anyone else have this issue, or have any experience/tips in decoding .xma files with ffmpeg?
FFmpeg needs to be tricked into ignoring the "fmt " chunks in those files, so it only parses the XMA2 chunks for format information. I tried to make it override at one point, but that didn't work. It needs to not even see the "fmt " chunks if there are "XMA2" chunks.
I did some grotesque header forgery and it's working ok. I'll take some time to check variations and stuff though. (maybe it's just easier to fix it in FFmpeg itself)
Chopping out the "fmt " chunk will "fix" it too. Maybe add a check to FFmpeg to search for the XMA2 chunk separately first, then bypass the fmt chunk if an XMA2 chunk is found? And don't forget to submit your patch to the ffmpeg devel mailing list!
The main problem is that the XMA2 chunk has some variations but FFmpeg only supports one. I can reconstruct the header ignoring the fmt and moving XMA2 data around where FFmpeg expects it but it's so ugly.
Patching FFmpeg wouldn't be so hard but on the other hand it could take a while (months?) to propagate plus having to go through all their hoops.