File Exchange

image thumbnail

Video Recorder

version 1.1.0.0 (4.03 KB) by Eric Ogier
Video recorder for dynamic figure

13 Downloads

Updated 26 Mar 2016

View License

"Video Recorder" is an object dedicated to the recording of dynamic MATLAB figures in video files (formats: AVI, JPEG 2000 and MPEG-4).
The object results from the combination of "timer" and "VideoWriter" MATLAB objects and allows two recording modes:
- Timed recording, synchronized by an internal timer set and started by user
- Manual recording, through a method called by user
Video demonstrations:
https://www.youtube.com/watch?v=MuhbvTWzgao&list=PLJXyTqQS4FL0fUzroict9erTNW7uL-1Wg&index=1&ab_channel=Pseudonymeoriginal


https://www.youtube.com/watch?v=WN_U_rAuPms&list=PLJXyTqQS4FL0fUzroict9erTNW7uL-1Wg&index=2&ab_channel=Pseudonymeoriginal

Cite As

Eric Ogier (2020). Video Recorder (https://www.mathworks.com/matlabcentral/fileexchange/56100-video-recorder), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

Gives the following error

>> Test_plot
'fieldnames' is not an accessible method of base class 'hgsetget'.

Error in VideoWriter/fieldnames (line 556)
res = fieldnames@hgsetget(obj,varargin{:});

Error in VideoRecorder/ispropertyvideowriter (line 298)
Properties = fieldnames(Object.Recorder);

Error in VideoRecorder/set (line 166)
[is2, Property2] = ispropertyvideowriter(Object,Properties{n});

Error in VideoRecorder (line 151)
set(Object,Property,Value);

Error in Test_plot (line 14)
VR = VideoRecorder('Filename', Filename,...

Eric Ogier

Thank you for your message. I have never tried to record a video from a webcam but I found this link :
http://fr.mathworks.com/matlabcentral/answers/5634-image-capture-using-webcam
The corresponding code is:
vid = videoinput('winvideo', 1);
set(vid, 'ReturnedColorSpace', 'RGB');
img = getsnapshot(vid);
imshow(img);
This code seems to extract the frame called "img" with "getsnapshot" function the same way "getframe" function does it for a figure.
You could try to record it through a "VideoWriter" object like that :
YourVideoWriter = VideoWriter('WebCamVideo','MPEG-4');
writeVideo(YourVideoWriter,img);

Ali Tareq

Good job! I have a related question, however it may be simple I could not do that.

I've faced problem recording video from webcam. in older version of matlab, specifically release 2013 I could, but in 2015 I cannot work with new functions. Please help me!

Updates

1.1.0.0

Correction of a bug in record file naming.

1.0.0.0

Adding of video demonstrations link.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux