Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/gifs #93

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d2da41d
added base for gif generation
elswit May 30, 2023
149a514
added gui boxes for movie generation
elswit Jun 2, 2023
bcf85cb
removed junk files
elswit Jun 2, 2023
97d87a3
fixed movie size bug
elswit Jun 2, 2023
bf1e840
fine tunning the script
elswit Jun 4, 2023
9abff9b
up animations script, adding a test webm
elswit Jun 26, 2023
50227b3
testing webm embedding
elswit Jun 26, 2023
50dd4e0
testin animation embeddings
elswit Jun 26, 2023
bc32cb5
testing gif embeddings
elswit Jun 26, 2023
05e1aca
testing animations
elswit Jun 26, 2023
f1702c6
added nbody animation
elswit Jun 26, 2023
aaa84f1
added nbody animation
elswit Jun 26, 2023
86eec50
added more animations
elswit Jun 26, 2023
65f4059
added more animations
elswit Jun 26, 2023
910fe86
Update README.md
elswit Jun 26, 2023
6a43fdb
rebased gifs branch from master
elswit Jun 26, 2023
ea0b2b0
Update README.md
elswit Jun 26, 2023
06467c3
Update README.md
elswit Jun 26, 2023
362de7e
Update README.md
elswit Jun 27, 2023
3c5ec81
added loop to all gifs
elswit Jun 27, 2023
545eb45
up script
elswit Jun 27, 2023
b1e4754
Update README.md
elswit Jun 28, 2023
fd10495
Update README.md
elswit Jun 28, 2023
a4a02ab
added QG gif
elswit Jun 29, 2023
6723354
Merge branch 'feature/gifs' of https://github.com/ComputationalScienc…
elswit Jun 29, 2023
f06b3db
removed large gif
elswit Jun 29, 2023
336dae9
Update README.md
elswit Jul 7, 2023
fc46d7f
Update README.md
elswit Jul 7, 2023
23365e1
Update README.md
elswit Jul 7, 2023
c52ce9d
Merge branch 'feature/gifs' of https://github.com/ComputationalScienc…
elswit Jul 8, 2023
a09c087
moved animations to sub dir in images
elswit Jul 8, 2023
9b20b25
moved animations to sub dir in images
elswit Jul 8, 2023
956e640
Update README.md
elswit Jul 12, 2023
737cfee
up movie script
elswit Oct 25, 2023
9135d66
added webm files
elswit Oct 25, 2023
8e68ff5
Update README.md
elswit Oct 25, 2023
d84aba7
Merge branch 'master' into feature/gifs
elswit Sep 23, 2024
e2d1c5f
Update README.md
elswit Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions gallery/makeMovie.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
close all

presets = getpresets();

if ~ isfolder('animations')
elswit marked this conversation as resolved.
Show resolved Hide resolved
mkdir('animations')
end


listAllExperiments = {};

for preset = presets
listAllExperiments{end+1} = preset.presetclass;
end
elswit marked this conversation as resolved.
Show resolved Hide resolved

% select test problem and preset
[indx,tf] = listdlg('PromptString', ...
{'Select a test problem',...
'Only one problem can be selected at a time.',''},...
'ListSize',[250,500], ...
'InitialValue', 22, ...
'OKString','Select', ...
'SelectionMode','single','ListString',listAllExperiments);

if tf
eval(strcat(['problem =', listAllExperiments{indx}]));
elswit marked this conversation as resolved.
Show resolved Hide resolved

vid_format = questdlg('Select Output format', ...
'Supported Formats:','Avi','Gif','Webm', 'Avi');

experiment = strsplit(listAllExperiments{indx},'.');
filename = strcat('animations/', experiment{2},'-', experiment{4});


if ~isempty(vid_format)
sol = problem.solve('RelTol', 1e-8);
mov = problem.movie(sol, 'Save', filename);
end


% convert vido format if neccessary
switch vid_format
case 'Avi'

case 'Gif'

args = strcat(['-i ' ...
elswit marked this conversation as resolved.
Show resolved Hide resolved
filename,'.avi ' ...
filename,'.gif']);

case 'Webm'

args = strcat(['-i ' ...
filename,'.avi ' ...
'-c:v libvpx -crf 10 -b:v 1M -c:a libvorbis '...
filename,'.webm']);

end

if ~strcmp(vid_format,'Avi') && ~isempty(vid_format)

prompt = {'Ffmpeg is required for video conversion'};
dlgtitle = 'Enter path to ffmpeg:';
dims = [1 35];
definput = {'/opt/homebrew/bin/ffmpeg'};
elswit marked this conversation as resolved.
Show resolved Hide resolved
ffmpeg = inputdlg(prompt,dlgtitle,dims,definput);

if ~isempty(ffmpeg)

command = strjoin(strcat([ffmpeg,' ' , args]));
system(command);
delete(strcat(filename,'.avi'));
end

end



end





2 changes: 1 addition & 1 deletion src/+otp/+utils/+movie/Movie.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function record(obj, t, y)

fig = figure;
if ~isempty(obj.Config.Size)
fig.Position = [0; 0: obj.Config.Size(:)];
fig.Position = [0; 0; obj.Config.Size(:)];
end

obj.init(fig, state);
Expand Down