How to embed mp4 files

I want to show a short movie (mp4) both on front and back. I know how to embed a still image by using the paperclip icon but the icon doesn’t seem to work with a movie file. Thanks for your help.

From the documentation: https://docs.ankiweb.net/#/editing

You can use the paperclip button to select audio, images and videos from your computer’s hard drive to attach to your notes. Alternatively, you can copy the media onto your computer’s clipboard (for instance, by right-clicking an image on the web and choosing ‘Copy Image’) and paste it into the field that you want to place it in. For more information about media, please see the media section.

You can also try coping the video into your Media Collection Directory (https://docs.ankiweb.net/#/files?id=file-locations) and using the HTML video tag:

<video id="myvid1" src="myvideo.mp4" controlsList="nodownload" controls></video>
  1. https://anki.tenderapp.com/discussions/ankidesktop/41589-external-links-in-cards
1 Like

I do not recommend using video tags at the moment. The computer version only supports a limited number of video formats when used in this way, and the check media function will report the files as missing. At the moment, the only officially supported way to use video is to put it in a [sound:…] tag, which the attach media button will do for you.

Dear addons_zz
Thank you so much for your prompt advice. Actually I did follow the directions in the documentation you have quoted: “You can use the paperclip button to select audio, images and videos from your computer’s hard drive to attach to your notes.” But a blank green screen is shown on the MPlayer window when the video is being played, while the audio is faithfully played. So the problem now boils down to that of playing the attached video instead of the problem of embedding a video. The HTML video tag you suggested as an alternative is too hard for me to use.

What is the format of the video you are trying to add? Perhaps you can try converting it to to some other encoding/format?

What is your platform? Linux?

Dear addons_zz

Thanks for replying so quickly. The format of the video I’m trying to add is MP4, the most common format. I have tried AVI but to no avail: the same green blank MPlayer screen appeared. My platform is Windows 10.

You can try installing the latest beta version of Anki (for windows 10) which uses a new player (mpv instead of mplayer): https://betas.ankiweb.net/ (if it still not working, you can try installing the alternate version)

To clarify, it’s only an alpha at this stage, so please make sure you make backups.

Dear addons_zz

Thanks for your advice. I have installed the latest beta version of Anki as you suggested, but the green MPlayer still appears. Do I have to do something to change from MPlayer to MPV? For your information, my newly installed MPV.exe is lodged in C:\users\NEC-PCuser\documents.

Dear addons_zz,

I have checked if the mpv works properly. I activated mpv and dropped a mp4 file, and, voi-la, the file beautifully played, which means nothing is wrong with mpv. The problems seems to be Anki’s access to mpv.

Can you launch Anki using anki-console.exe (When Anki doesn’t start on Windows (debugging steps)) and post here the output of the console when you try to review a video? This could be related to this old thread: sound playing after 10sec or more

Are you sure you installed the latest alfa version? mpv is only available at alpha2 version or above:

anki-2.1.28alpha3-f44597bb-windows-alternate.exe   09-Jun-2020 19:38     82M
anki-2.1.28alpha3-f44597bb-windows.exe             09-Jun-2020 19:38    102M

image

Dear addons_zz,

I’m glad that we are coming closer to the solution.

Here’s the output of the console:

er Bootloader 3.x
[3300] LOADER: executable is C:\Program Files\Anki\anki-console.exe
[3300] LOADER: homepath is C:\Program Files\Anki
[3300] LOADER: _MEIPASS2 is NULL
[3300] LOADER: archivename is C:\Program Files\Anki\anki-console.exe
[3300] LOADER: C:\Program Files\Anki\anki-console.exe contains a digital signature
[3300] LOADER: No need to extract files to run; setting extractionpath to homepath
[3300] LOADER: SetDllDirectory(C:\Program Files\Anki)
[3300] LOADER: Already in the child - running user’s code.
[3300] LOADER: Python library: C:\Program Files\Anki\python38.dll
[3300] LOADER: Loaded functions from Python library.
[3300] LOADER: Manipulating environment (sys.path, sys.prefix)
[3300] LOADER: sys.prefix is C:\Program Files\Anki
[3300] LOADER: Pre-init sys.path is C:\Program Files\Anki\base_library.zip;C:\Program Files\Anki
[3300] LOADER: Setting runtime options
[3300] LOADER: Initializing python
[3300] LOADER: Overriding Python’s sys.path
[3300] LOADER: Post-init sys.path is C:\Program Files\Anki\base_library.zip;C:\Program Files\Anki
[3300] LOADER: Setting sys.argv
[3300] LOADER: setting sys._MEIPASS
[3300] LOADER: importing modules from CArchive
[3300] LOADER: extracted struct
[3300] LOADER: callfunction returned…
[3300] LOADER: extracted pyimod01_os_path
[3300] LOADER: callfunction returned…
[3300] LOADER: extracted pyimod02_archive
[3300] LOADER: callfunction returned…
[3300] LOADER: extracted pyimod03_importers
[3300] LOADER: callfunction returned…
[3300] LOADER: Installing PYZ archive with Python modules.
[3300] LOADER: PYZ archive: PYZ-00.pyz
[3300] LOADER: Running pyiboot01_bootstrap.py
[3300] LOADER: Running pyi_rth_multiprocessing.py
[3300] LOADER: Running pyi_rth_win32comgenpy.py
[3300] LOADER: Running pyi_rth_pyqt5.py
[3300] LOADER: Running pyi_rth_certifi.py
[3300] LOADER: Running pyi_rth_pkgres.py
[3300] LOADER: Running pyi_rth_pyqt5webengine.py
[3300] LOADER: Running runanki.py
ignored late bridge cmd domDone
ignored late bridge cmd domDone

Can you find mpv.exe when you go to the directory C:\Program Files\Anki?

Can you find mplayer.exe when you go to the directory C:\Program Files\Anki? If you find it, can you drop a video on it and see if it plays?

Can you go to the menu Help -> About and confirm you are using Anki version 2.1.28alpha3 Build f44597bb?

I find mplayer.exe in the directory C:\Program Files\Anki` but not mpv.exe. Should I replace mplayer.exe with mpv.exe? In fact I tried to copy mpv.exe into the directory but somehow I couldn’t.
Anki version is 2.1.28 (97eadb78).

Build 97eadb78 is not the latest version of anki. Please see How to embed mp4 files

Dear addons_zz,
I have installed the latest version of Anki as you suggested, and I managed to copy mpv.exe into the Anki directory. And … the mp4 file did play!! I don’t know how to thank you enough, for I have long wanted to embed mp4 files but I always failed.