Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start recording video using the PiCamera.
Raspberry Pi
from picamera import PiCamera camera = PiCamera() camera.[1]('video.h264')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using stop_recording instead of start_recording.
Using capture which is for photos, not video.
✗ Incorrect
The start_recording method begins recording video to the specified file.
2fill in blank
mediumComplete the code to stop recording video.
Raspberry Pi
from picamera import PiCamera camera = PiCamera() camera.start_recording('video.h264') # After some time camera.[1]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using start_recording again instead of stop_recording.
Using capture which is for photos.
✗ Incorrect
The stop_recording method stops the video recording.
3fill in blank
hardFix the error in the code to record a 5-second video.
Raspberry Pi
from picamera import PiCamera import time camera = PiCamera() camera.start_recording('video.h264') time.[1](5) camera.stop_recording()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using time.wait or time.pause which do not exist.
Not pausing the program, so recording stops immediately.
✗ Incorrect
The time.sleep(5) pauses the program for 5 seconds while recording.
4fill in blank
hardFill both blanks to record a video with resolution 640x480 and framerate 24.
Raspberry Pi
from picamera import PiCamera camera = PiCamera() camera.[1] = (640, 480) camera.[2] = 24 camera.start_recording('video.h264')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using brightness or contrast instead of resolution or framerate.
Setting properties after starting recording.
✗ Incorrect
Set resolution to (640, 480) and framerate to 24 before recording.
5fill in blank
hardFill all three blanks to record a video file named 'myvideo.h264' with resolution 1280x720 and framerate 30.
Raspberry Pi
from picamera import PiCamera camera = PiCamera() camera.[1] = (1280, 720) camera.[2] = 30 camera.start_recording('[3]')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong property names.
Using wrong filename string.
Setting properties after starting recording.
✗ Incorrect
Set resolution and framerate properties, then start recording to 'myvideo.h264'.
