💡 make anki detect media file changes when synchronizing

Currently media file changes of existing files inside

%APPDATA%\Anki2\Benutzer 1\collection.media

do not seem to be recognized or synchronized with other devices. This program behavior does not correspond with the user’s usage expectation and should therefore be adjusted.

The current workaround noted in the Wiki is problematic: Because …
(1) this is not in line with usage expectations
(2) users should not be expected to have read the entire wiki before use
(3) This complicates the resource maintenance of/through extensions.

Related video: Syncing in Anki: Sounds and Images - YouTube
Anki will synchronize any sounds and images used by your notes. It will notice when media has been added or removed from your media folder, but will not notice if you have edited some existing files without adding or removing any. To get your edits noticed, you need to add or remove a file as well.
If you’re running Anki off a USB flash drive, you should use an NTFS file system, as Anki may not be able to detect media changes on a FAT32 filesystem.

Case: On device A File_1 is created. This state is synced over to device B as expected. Device A now makes a change to File_1. This change is not applied to device B. (Device A: Windows; Device B: Android)

1 Like

I’ve noticed this as well, but I was having trouble articulating it. I believe my situation should align with yours.

  1. Card is created with audio (sound.mp3) on Anki Desktop.
  2. Sync on Desktop.
  3. Sync on AnkiMobile.
  4. On desktop, I open the file in MP3Gain to raise the volume of the mp3 without re-encoding.
  5. Sync on Desktop.
  6. Sync on AnkiMobile.

Result: Anki Desktop has a louder sound.mp3 than AnkiMobile because the change didn’t come over.

In this example, the name and file size of sound.mp3 wouldn’t change, but its content (volume) would.

1 Like

It’s a performance optimization. I experimented with doing the check on every sync, and it caused media syncs to become perceptibly slower for users with larger media folders.

1 Like

Totally makes sense. But if I’m in that situation, what’s the best way to fix it?

Easiest way is to add or remove a file: Syncing with AnkiWeb - Anki Manual


Since manually added files should be added with the naming scheme “_*” and it can be assumed that especially manually added files will be modified, it might be a temporary solution to check ONLY these files each sync time.

Or preferably a proper solution by implementing a rsync like approach for media files … at least as option triggered by (1) “the user” (2) “time interval since last complete synchronization”.

Rename the file, adding an underscore at the start, so it becomes like “_arial.ttf”. Adding an underscore will tell Anki that this file will be used on a template, and should not be deleted when checking for unused media. [docs.ankiweb.net]

That doesn’t solve the cases where users modify existing normal files, such as resizing images, and looking for all underscore files still requires iterating over the entire folder.