How can I set the video size using VideoWriter to a resolution greater than my monitor?

147 views (last 30 days)
I am currently using VideoWriter to produce a video file of a series of figures (i.e. the same figure with more data showing in each frame). As this is to do with a media project, I have been asked if I can produce it in HD (1920x1080). I am saving it in MPEG-4 format (requested)
There are two ways of setting the image size (from what I've read).
1-use the properties of VideoWriter to set these i.e.
writerObj.Height=1080;
writerObj.Width=1920;
2-set the size of the figure to the required resolution. i.e.
figure('units','pixels','position',[0 0 1920 1080])
However, the first option doesn't allow me, reporting "You cannot set the dynamic property 'Height'"
The second option displays the figure at HD. However, this produces an image that spans across two monitors (I'm running a 4 monitor set-up) because the resolution of each is less than the 1920x1080. This then produces a recording of the part of the image that is on one monitor.
Any help would be greatly appreciated.
Thank you

Answers (2)

Jiarui Kang
Jiarui Kang on 6 Jan 2022
I run into the same issue of having poor video from VideoWriter. The resolution is low even in a uncompressed .avi hundreds of MB. And I was able to fix it by adding:
figure('units','pixels','position',[0 0 1440 1080])
before plot

Walter Roberson
Walter Roberson on 15 Apr 2014
VideoWriter writes whatever size the data is that you pass to be written. The difficulty is not in VideoWriter but in obtaining the data at a high enough resolution.
You can create your data at higher resolution by using print() to create image files that you read and pass to videowriter. (Watch out for the rest of the figure being captured though.)

Community Treasure Hunt

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

Start Hunting!