14
$\begingroup$

I am trying to use the FFImport function using the ffmpeg package. Having installed ffmpeg on our Windows 11 system (following [1]), Mathematica still does not seem to recognize the installed package. Alternatively, on evaluating $VideoDecoders in Mathematica, it gives a pop-up window asking me to "Install Full Video Codec Support" -- Mathematica pop-up for installing the full version of FFmpeg. After installation and a restart (of Mathematica), it still does not recognize the installation. Though the package seems to be present in the "\AppData\Roaming\Mathematica" folder. How can I get Mathematica to recognize the ffmpeg package installed on my system or to recognize its own installation?

$\endgroup$
8
  • 3
    $\begingroup$ Maybe useful community.wolfram.com/groups/-/m/t/2177967 ([How to install FFmpeg on Windows 10). $\endgroup$ Feb 2, 2022 at 19:16
  • 1
    $\begingroup$ Have you seen: reference.wolfram.com/language/tutorial/… $\endgroup$ Feb 2, 2022 at 19:49
  • 1
    $\begingroup$ @b.gates.you.know.what -- Followed the instructions you referenced. The package works correctly through the cmd line, but alas, not in Mathematica, yet. $\endgroup$ Feb 2, 2022 at 22:30
  • 1
    $\begingroup$ @Daniel Huber -- added the directory for the dll's and the executable as suggested in the tutorial you referenced, but (again), alas, Mathematica fails to recognize the package and gives the same behavior. $\endgroup$ Feb 2, 2022 at 22:30
  • 1
    $\begingroup$ Good. If Wolfram answers something interesting, please report it here. $\endgroup$ Feb 3, 2022 at 16:08

3 Answers 3

5
+100
$\begingroup$

According to this post, I found the reason.

In C:\Program Files\Wolfram Research\Mathematica\13.0\SystemFiles\Links\FFmpegTools\Kernel\Common.m, line 79 and 80:

$WindowsWLFFmpegDlls = {"avutil-56.dll", "swresample-3.dll", "swscale-5.dll", "avcodec-58.dll", "avformat-58.dll", "avfilter-7.dll", "avdevice-58.dll"};
$WindowsSystemFFmpegDlls = {"avutil-56.dll", "postproc-55.dll", "swresample-3.dll", "swscale-5.dll", "avcodec-58.dll", "avformat-58.dll", "avfilter-7.dll", "avdevice-58.dll"};

For example, when you run $VideoDecoders, Mathematica will first find out if FFmpeg is installed on your computer and get its path. If it is installed, then Mathematica will check if its libraries match the above version. If they do not match, message box will show and remind to install FFmpeg 4.4.1.

The problem is if you have installed FFmpeg 5.0, because its libraries are more up-to-date, Mathematica can't match and still reminds to install FFmpeg 4.4.1. After the installation, there are two FFmpeg in PATH. When Mathematica get the path to FFmpeg 5.0, it falls into a loop.

Simply edit line 79 and 80 in Common.m cannot solve the problem (I have tried this. Other editing may be required.). The correct way is to remove FFmpeg 5.0 in PATH, only reserve FFmpeg 4.4.1.

$\endgroup$
1
  • $\begingroup$ I can confirm that installing ffmpeg-4.4.1-full_build-shared, and adding the path to the windows PATH variable removes the warning message in Wolfram Engine V13.0 $\endgroup$
    – rhermans
    Feb 21, 2022 at 10:51
1
$\begingroup$

A kludge for the time being is as follows:

Followed the instructions at https://github.com/kmisiunas/ffmpeg-mathematica. Downloaded the files from there and moved them to a local folder "C:\Users\HERCULE\AppData\Roaming\Mathematica\ffmpeg-
mathematica-master"

In the .nb where ffmpeg is to be used, evaluated

Import["C:\\Users\\HERCULE\\AppData\\Roaming\\Mathematica\\ffmpeg-mathematica-master\\FFmpeg.m"];
FFmpeg[](*To ensure that the ffmpeg package is functional*)

Works for now!

$\endgroup$
1
  • $\begingroup$ This is related and interesting, but I don't think it answers the question. $\endgroup$
    – rhermans
    Feb 15, 2022 at 17:08
1
$\begingroup$

Ok, I solved this annoying problem just by downloading an order version of FFmpeg. Here is the link I downloaded from: https://sourceforge.net/projects/ffmpeg-windows-builds/files/release/n4.3.1/ After downloaded the 4.3.1ver FFmpeg, just install it with the method from this link:https://community.wolfram.com/groups/-/m/t/2177967. The key is downloading a CORRECTED VERSION of FFmpeg. To solve this problem which stuck me about a week, you can only use the version which bin folder have "avutil-56.dll", "swresample-3.dll", "swscale-5.dll", "avcodec-58.dll", "avformat-58.dll"files and the number suffix should pair the file inC:\Program Files\Wolfram Research\Mathematica\13.0\SystemFiles\Links\FFmpegTools\Kernel\Common.m

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.