Faster way to save video from uifigure and geoglobe
Hi,
I need a faster way to get video output saved from a uifigure if possible.
I’m recording a camera fly using a geoglobe into an MP4 using VideoWriter. in my understanding the figure has to be a uifigure because geoglobe requires it. Each frame is captured with getframe(fig) and written with writeVideo.
For a ~30 min sim at 5 FPS (~10,000 frames at 1280×720) takes ~4 hours.
psuedo code:
fig = uifigure(‘Position’,[100 100 1280 720], ‘Visible’,’on’);
glo = geoglobe(fig, ‘Basemap’,’satellite’);
vid = VideoWriter(out_path, ‘MPEG-4’);
vid.FrameRate = 5;
vid.Quality = 85;
open(vid);
% …
% Loop:
for fi = 1:nFrames
% … compute cam_lat, cam_lon, cam_alt, cam_heading, cam_pitch, cam_roll …
campos(glo, cam_lat, cam_lon, cam_alt);
camheading(glo, cam_heading);
campitch(glo, cam_pitch);
camroll(glo, cam_roll);
drawnow
frame = getframe(fig);
writeVideo(vid, frame.cdata);
end
close(vid);
Things I’ve already tried and didn’t work:
FPS and Quality are already set to minimum desirables.
Switched the encoder to ‘Motion JPEG AVI’ but didn’t help.
I was wondering if there is a way for the process to be parallelized, or any other way that is faster?Hi,
I need a faster way to get video output saved from a uifigure if possible.
I’m recording a camera fly using a geoglobe into an MP4 using VideoWriter. in my understanding the figure has to be a uifigure because geoglobe requires it. Each frame is captured with getframe(fig) and written with writeVideo.
For a ~30 min sim at 5 FPS (~10,000 frames at 1280×720) takes ~4 hours.
psuedo code:
fig = uifigure(‘Position’,[100 100 1280 720], ‘Visible’,’on’);
glo = geoglobe(fig, ‘Basemap’,’satellite’);
vid = VideoWriter(out_path, ‘MPEG-4’);
vid.FrameRate = 5;
vid.Quality = 85;
open(vid);
% …
% Loop:
for fi = 1:nFrames
% … compute cam_lat, cam_lon, cam_alt, cam_heading, cam_pitch, cam_roll …
campos(glo, cam_lat, cam_lon, cam_alt);
camheading(glo, cam_heading);
campitch(glo, cam_pitch);
camroll(glo, cam_roll);
drawnow
frame = getframe(fig);
writeVideo(vid, frame.cdata);
end
close(vid);
Things I’ve already tried and didn’t work:
FPS and Quality are already set to minimum desirables.
Switched the encoder to ‘Motion JPEG AVI’ but didn’t help.
I was wondering if there is a way for the process to be parallelized, or any other way that is faster? Hi,
I need a faster way to get video output saved from a uifigure if possible.
I’m recording a camera fly using a geoglobe into an MP4 using VideoWriter. in my understanding the figure has to be a uifigure because geoglobe requires it. Each frame is captured with getframe(fig) and written with writeVideo.
For a ~30 min sim at 5 FPS (~10,000 frames at 1280×720) takes ~4 hours.
psuedo code:
fig = uifigure(‘Position’,[100 100 1280 720], ‘Visible’,’on’);
glo = geoglobe(fig, ‘Basemap’,’satellite’);
vid = VideoWriter(out_path, ‘MPEG-4’);
vid.FrameRate = 5;
vid.Quality = 85;
open(vid);
% …
% Loop:
for fi = 1:nFrames
% … compute cam_lat, cam_lon, cam_alt, cam_heading, cam_pitch, cam_roll …
campos(glo, cam_lat, cam_lon, cam_alt);
camheading(glo, cam_heading);
campitch(glo, cam_pitch);
camroll(glo, cam_roll);
drawnow
frame = getframe(fig);
writeVideo(vid, frame.cdata);
end
close(vid);
Things I’ve already tried and didn’t work:
FPS and Quality are already set to minimum desirables.
Switched the encoder to ‘Motion JPEG AVI’ but didn’t help.
I was wondering if there is a way for the process to be parallelized, or any other way that is faster? uifigure, geoplot, writevideo MATLAB Answers — New Questions









