@v77
It would be interesting to know how much is "some KB".
I.e., you can't have an exact formula and "some KB" in the same post.
And the formula is anyway "wrong", in the sense that what a file occupies on a filesystem is clusters (and not sectors).
@Azev
The size of 197916303 is the actual file size, but if you right click on the file-> Properties you will find two sizes listed, one is file size, the other one is file size on disk, you need to use the latter as base (no need for formulas).
In the best case the result will be "exact" (if the volume it resides on is a "normal" NTFS with 4 KB clusters) in the worst case it will be a little smaller than needed (if the volume has smaller clusters), but even in the worst case it will be off at the most of "a few KB", not a problem since you have to add "some KB" anyway to get the parameter to pass to IMDISK.
BUT, there is another problem exFAT (by design) is intended for large files/large volumes/whatever, so essentially it is "wasteful" tending to have "largish" cluster sizes:
https://support.micr...-fat-and-exfat
your file is below 256 MB so it is fine with 4 KB clusters, but if another video crosses the 256 MB "boundary" you will need a bigger than 256 MB volume, and then the default cluster size will become 32 KB.
So, an exact formula will depend also on cluster size (which in itself depends on size of the filesystem, which depends on size of the file).
You need to make a formula based on clusters (minimal unit addressable by the filesystem) and not on sectors (minimal unit addressable of a block device).
The 2048 * 512 = 1048576 bytes (not 2048 bytes) extra are not "enough KB" however, even if they work in this single example.
But then, unlike FAT 12/16/32 File Allocation Tables in exFAT are not really-really fat's but some form of pointers to (very like NTFS) a bitmap.
So, unlike FAT12/16/32, it is not just a matter of counting the clusters and calculate the size of the FAT(s) and - and this may depend on the OS you are running - it has to be seen if you will be making exFAT or TexFAT volumes (basically 1 or 2 copies of the FAT) see :
https://www.sans.org...le-system-33274
all in all, if you want an exact formula you will have to do a lot of research and tests.
If you are OK with an approximate formula, I would try with:
(int(fileSizeInBytes/4096) * 1.03) * 4096
The 1.03 (which basically means "consider roughly 120 bytes of indexing for each cluster in the filesystem") can of course be tuned by making a few tests, it's only a starting point, probably a 1.02 (i.e.roughly 80 bytes per cluster) will be enough, possibly even less.
But since all in all we are talking of 200-300 MB volumes, it would make little sense to go very tight, the difference would be in the order of magnitude of 2 or 3 MB.
If it is 4 GB sized files (and volumes) it goes in the 40 MB approximation, which might start to have some (very little) relevance.
Wonko