Use ffmpeg in Matlab

10 vues (au cours des 30 derniers jours)
Yongqian Yang
Yongqian Yang le 23 Sep 2014
Commenté : Eric le 8 Mai 2024
Hi, all I'm trying to use the software 'ffmpeg' in Matlab. I'm using Mac system with Matlab 2012a. I had installed the ffmpeg software and could run it in the Mac terminal. However, when I tried to use it in Matlab with the command "system('ffmpeg xxxxxx')" and "unix('ffmpeg xxxx')", Matlab gave the error message that "/bin/bash: ffmpeg: command not found". My ffmpeg is in directory "/opt/local/bin", which is not included in Matlab's $PATH variable when I typed "system('echo $PATH')" in Matlab. I tried to use "system('export PATH=$PATH:/opt/local/bin')" in Matlab, but "system('echo $PATH')" still showed that the directory "/opt/local/bin" was not included. http://www.mathworks.com/matlabcentral/newsreader/view_thread/255609 This link mentioned about modifying the "$MATLAB/bin/matlab" file to add $PATH. However, even though I used "sudo chmod +wrx " to clear the readonly attribute of this file, I could not modify it because it still said the file was readonly. Does anyone have any idea about how to use ffmpeg in Matlab? Thanks a lot in advance.
Regards Yongqian

Réponses (1)

Yongqian Yang
Yongqian Yang le 24 Sep 2014
The problem about "readonly" is solved by using "chmod 777 matlab".
Another problem occurred when I used "unix('ffmpeg xxxxx')":
"dyld: Library not loaded: /opt/local/lib/libfreetype.6.dylib Referenced from: /opt/local/bin/ffmpeg Reason: Incompatible library version: ffmpeg requires version 18.0.0 or later, but libfreetype.6.dylib provides version 10.0.0 ffmpeg -version: Trace/breakpoint trap"
I had updated the ffmpeg just now, but the problem was still there. I can use ffmpeg in the Mac terminal, so I'm not sure why I cannot use it in Matlab... Anyone has any idea?
Thanks
Yongqian
  3 commentaires
Peter Krumholz
Peter Krumholz le 12 Déc 2023
Solved mine too!
Eric
Eric le 8 Mai 2024
Erdem's solution fixed mine too! Matlab r2024a, Apple Silicon M2 chip, ffmpeg version 7.0

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by