How do M4a BGM files know when to loop..?

I've looked at a few 'stock' m4a files, using Audacity, and see that they appear to have no Loop metadata tags like OGG files. I've no Android apparatus to even test, but I assume that 'Battle1', for instance, loops on Android just like on a PC, but where does it get the Loop information..? Does it come from the equivalent OGG file, if present..? Is there something hidden I've not seen..? Or does it simply not loop..? I compose for my own Games, and know how to set up the OGG files for looping, but when converted to M4a, will my files still loop..? How..?


Puzzled... 
yMRFAS7.png
Using the ExifToolGui on a M4A file, you can see the LOOPSTART and LOOPLENGTH tags are present.


exif-m4a.png


 
​


I am not certain as to why the tags do not show up in Audacity, but I am fairly certain you can insert the tags in the standard fashion and everything will loop fine.
@Exhydra...


Many thanks, that's very useful. I'll add them with Audacity, then have a quick check with the tool you mention. Cheers. 
R91KekF.gif



Sorry; back again with a subsidiary question. Yes, I can see the metadata in the default BGM files now, using Exiftool (on Windows 10...). However, despite having read the extensive 'Help' screen, and having searched t'web, I still can't see how to create a custom tag (LOOPSTART and LOOPLENGTH...) in my own m4a files. If the tag existed, I could write the loop info to the tag, but every attempt so far ends with a laconic Warning: Tag 'LOOPSTART' doesn't exist. Nothing to do. Yes, there is; create the tag..! I see sttuff about config files, but there's nothing but the bare ExifTool, nothing more. Any tips, please..?


Here's the command I'm passing at the moment...


exiftool(-LOOPSTART+=363825 -LOOPLENGTH+=3263400 -k).exe
Hmm ... you should be able to output M4A files with Audacity, and then insert the meta-tags at that point.
Sometimes, simple questions have simple solutions. This is one of those times. Upon looking closer, I now see the m4a options for export with Audacity, and was able to save, with the tags. Will it work in the Game..? Dunno, but it should do.


Thanks for all the help; this question can now be closed.


Edit: Once again, I typed too soon. Audacity does, indeed, allow for the addition of metadata fields, but doesn't export them..! When I check with Exiftool, they're not there, and when I reload into Audacity, it's as if I'd never edited. Even the existing fields I'd filled in are now empty. Deception, and back to the drawing board. I'm gald I don't use these m4a files myself; I'd go crackers..! Maybe that's the solution; not even consider  Android, and limit deploying stuff to Windows or Mac..? 
yMRFAS7.png
Actually, I'm pretty sure Android uses OGG, M4A is for Mac support.


Does this help? From the Audacity Manual:


Custom FFmpeg export options



In the Export dialog when you select Custom FFmpeg Export in the Save as type dropdown, then the Options pane will contain the Open custom FFmpeg format options button. Clicking on the button will bring up the custom options dialog. See Custom FFmpeg Export Options for more details.






Note that when using custom FFmpeg export it is necessary to supply the full file name and the extension in the File name: field as Audacity does not automatically add the extension in this case. Otherwise you will need to manually add the extension to the file name after export.
After fairly extensive searching, it would appear that Audacity are aware of the failure to retain custom metadata on these files, and that it is scheduled to be fixed in the next release (2.1.3...), so I shall just patiently await that version (no ETA that I know of...). I'm in no special need, as yet, but any deployment that I make pending this functionality will play badly on any platform using m4a files. Sorry, but I can't help that.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-m4a-bgm-files-know-when-to-loop.67143/