Recording Videos
Save any Python file with a preview as an MP4 video.
Record
- Open the
.pyfile and press Record Video in the editor's footer (or choose File → Record Video…). - Pick a size and a frame rate.
- Press Record.
The file runs again from the beginning and every frame goes into the video. An animation stops by itself at the end of its timeline. A file that keeps running (a Pyctures draw() loop, a game) records until you press the red button again, or Stop.
While it records, the button shows a red dot and how much video has been made so far.
Sizes
| Size | Pixels | For |
|---|---|---|
| 1080p | 1920 × 1080 | Most videos (16:9) |
| 4K | 3840 × 2160 | Large screens; the sharpest |
| 720p | 1280 × 720 | Smaller files |
| Shorts | 1080 × 1920 | Upright phone video (9:16) |
| Square | 1080 × 1080 | Square posts |
The frame rate is 30 or 60 frames a second. Your last choice is remembered.
The video is drawn at the size you pick, not copied from the screen, so 4K is sharper, not just bigger: lines and text are drawn again at that size.
Sound
Sounds the file plays (add_sound, music, and a voice-over given as section("Intro", sound="intro.mp3")) go into the video's sound track, at the same moments. See the sound functions.
No frame is dropped
The video is made frame by frame. Each frame is drawn at its exact moment (frame 90 at 30 frames a second is exactly 3 seconds in) and handed to the video before the next one is drawn. A slow computer takes longer to make the video, but the video itself plays smoothly at full speed, and the same file always makes the same video. Random numbers start the same way on every recording, so a scene that uses random records the same each time too.
An animation with nothing else running is made as fast as your computer can draw it, often faster than it plays. A file that reads the mouse or keys is recorded at real speed, so you can play a game while it records.
Where the video goes
The video is named after the file and the size, for example pythagoras 1080p.mp4.
- A file on your computer or a Circuit: the video is saved in the same folder as the
.pyfile. - Otherwise (a file in the cloud, or on the web): it is saved like any export, as a download, or to a place you pick on iPhone and iPad.
When it is done, the output under the preview says how many frames were recorded and where the video was saved.
If Record is greyed out
Making video needs the browser's built-in video encoder, which the desktop app always has. If the popup says This browser cannot make videos, record in the desktop app instead.
Tips for explainer videos
- In a Pyctures loop, move things by the frame's
dtinupdate(dt), or bynow(), never by a fixed step such ast += 1/60: a fixed step plays at half speed in a 30 frames a second video. - Use
wait()generously: viewers need a moment to read each step. - Each scene is a section of the video; split a long piece into scenes so it is easy to scrub and fix. See Scenes and sections.
- Pick Shorts for a phone video, then check that nothing falls off the sides: the picture is narrower, so move wide equations in or make them smaller.
Related
- Scenes and sections
- Pymations outside Circuitry: a web page instead of a video