-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathffmpeg_find_path.m
45 lines (33 loc) · 1.09 KB
/
ffmpeg_find_path.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function [ffmpeg_path] = ffmpeg_find_path()
% Find the path to ffmpeg
ffmpeg_path = '';
%% Mac options
if ~isempty(strfind(lower(computer), 'mac')) || ~isempty(strfind(lower(computer), 'apple'))
% see if ffmpeg is in the path
[status, message] = system('which ffmpeg');
if (status==0)
ffmpeg_path = message;
return;
end
% if no luck, start trying some common locations
try_path = '/opt/local/bin/ffmpeg';
[status, message] = system(['ls ', try_path]);
if (status == 0)
ffmpeg_path = try_path;
end
try_path = '/usr/local/bin/ffmpeg';
[status, message] = system(['ls ', try_path]);
if (status == 0)
ffmpeg_path = try_path;
end
% otherwise, return with empty string
return;
end
%% (otherwise) PC options
[status, message] = system('where ffmpeg');
if status == 0
% wrap in double quotes and remove newline at end
ffmpeg_path = ['"' message(1:end-1) '"'];
return;
end
end