DoorDash launches a new ‘Tasks’ app that pays couriers to submit videos to train AI
Back to Tutorials
techTutorialbeginner

DoorDash launches a new ‘Tasks’ app that pays couriers to submit videos to train AI

March 19, 202613 views5 min read

Learn to build a basic video recording application using Python and OpenCV, demonstrating the technology behind AI training data collection systems like DoorDash's new Tasks app.

Introduction

In this tutorial, you'll learn how to create a simple video recording application that could be used for AI training purposes, similar to what DoorDash's new 'Tasks' app is doing. This hands-on project will teach you how to build a basic video capture interface using Python and OpenCV, which is the foundational technology behind many AI training data collection systems.

The 'Tasks' app pays couriers to submit videos to train AI models, and this tutorial will show you how to build a similar system that can record and save video from your webcam. This is a great starting point for understanding how AI training data is collected and processed.

Prerequisites

Before starting this tutorial, you'll need:

  • A computer running Windows, macOS, or Linux
  • Python 3.6 or higher installed on your system
  • Basic understanding of Python programming concepts
  • Webcam or built-in camera on your device

Step-by-Step Instructions

1. Install Required Python Packages

First, you need to install the necessary Python libraries. Open your terminal or command prompt and run:

pip install opencv-python

Why we do this: OpenCV (Open Source Computer Vision Library) is essential for video capture and processing. It provides the functions we need to access your webcam and record video.

2. Create Your Python Script

Create a new file called video_recorder.py and open it in your code editor. This will be the main file for our video recording application.

Why we do this: We're creating a dedicated file that will contain all our code for the video recording functionality.

3. Import Required Libraries

Add the following code to your video_recorder.py file:

import cv2
import datetime
import os

Why we do this: These libraries are essential for our video recording system. OpenCV handles the video capture, datetime helps us timestamp our recordings, and os lets us create directories for saving files.

4. Initialize Video Capture

Add the following code after your imports:

# Initialize the camera
video_capture = cv2.VideoCapture(0)

# Check if camera opened successfully
if not video_capture.isOpened():
    print("Error: Could not open camera.")
    exit()

Why we do this: This code initializes access to your webcam. The number 0 typically refers to your default camera, but you might need to change this if you have multiple cameras.

5. Set Video Recording Parameters

Add the following code to configure your video recording settings:

# Get the default resolutions
frame_width = int(video_capture.get(cv2.CAP_PROP_FRAME_WIDTH))
frame_height = int(video_capture.get(cv2.CAP_PROP_FRAME_HEIGHT))

# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter('output.mp4', fourcc, 20.0, (frame_width, frame_height))

Why we do this: We're setting up the parameters for our video file. The codec 'mp4v' creates MP4 format videos, 20.0 is the frame rate, and we're using the same resolution as your camera.

6. Create the Recording Loop

Add the following code to create the main recording loop:

print("Recording started. Press 'q' to stop.")

while True:
    # Capture frame-by-frame
    ret, frame = video_capture.read()
    
    if ret:
        # Write the frame to the video file
        out.write(frame)
        
        # Display the frame
        cv2.imshow('Video Recorder', frame)
        
        # Break the loop when 'q' is pressed
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    else:
        print("Error: Could not read frame.")
        break

Why we do this: This loop continuously captures frames from your webcam, saves them to a file, and displays them on screen. The 'q' key stops the recording.

7. Clean Up Resources

Add the following code at the end of your script:

# Release everything
video_capture.release()
out.release()

# Close all OpenCV windows
cv2.destroyAllWindows()

print("Recording finished and saved as output.mp4")

Why we do this: Properly releasing the camera and video writer resources prevents memory leaks and ensures your program exits cleanly.

8. Run Your Video Recorder

Save your video_recorder.py file and run it from your terminal:

python video_recorder.py

Why we do this: Running the script starts the video recording application, allowing you to test your implementation and see how it works.

9. Test Your Application

When you run the script:

  • Your webcam should activate
  • A window will appear showing the live video feed
  • Press 'q' to stop recording
  • A file named 'output.mp4' will be created in the same directory

Why we do this: Testing ensures your application works correctly and gives you hands-on experience with video capture technology.

Summary

In this tutorial, you've built a basic video recording application that demonstrates the core technology behind AI training data collection systems like DoorDash's Tasks app. You learned how to:

  • Install and use OpenCV for video capture
  • Initialize camera access and configure video parameters
  • Create a recording loop that captures and saves video frames
  • Properly manage resources and exit the application cleanly

This simple application shows how the technology works that enables couriers to submit videos for AI training. While DoorDash's system is more complex with payment integration and task management, this basic video recorder demonstrates the fundamental video capture functionality that powers such systems.

With this foundation, you can now explore more advanced features like saving videos with timestamps, adding audio recording, or integrating with cloud storage systems for AI training data collection.

Related Articles