How I Made My First Python App Using my personal AI Assistant

From Concept to Code

Gustavo Espíndola
7 min readJun 7, 2024

Have you ever faced a problem that seemed too complex to solve on your own?

That’s exactly what happened to me years ago, when I needed to share large video files with friends and colleagues. The native screen recording tools on my computer would generate massive .MOV files that were impossible to send via WhatsApp or Discord. I knew I needed a solution, but I didn’t know where to start. That’s when I turned to AI for help, and it changed everything.

The Problem I Tried to Solve. I had a recurring issue, recording my screen using the MacBook’s built-in tool and sharing the videos via Discord or WhatsApp was nearly impossible. A minute of recording would result in a file size of several megabytes, making it impossible to send. I searched for tools to solve this problem, but nothing seemed to fit my needs. I wanted something fast, simple (and free), and preferably something that could work offline.

First Steps into Programming with AI

Quickly, AI pair-programming partners became a common sight, even for me. As a UX designer, I had always been involved in software development teams, but beyond basic HTML, some CSS, and a bit of jQuery (don’t laugh at my age), I didn’t know much about more complex programming.

I immersed myself in the world of AI, unable to resist the urge to create something. The first thing I set out to do was to build my own video compression application: The ⚡▶ TurboClip, a python script to speed up and compress video files.

Designing the solution with AI’s Help

Sometimes we don’t know how to start, so, I asked a friend what programming language I should start with for this endeavor, and he recommended Python. I downloaded Visual Studio Code (VS Code) a tool for writing code and along with it, I downloaded CodeGPT a Vs Code plugin that delivers artificial intelligence assistants specialized in code, and I started to work on it.

1. First, How do I install Python?

  • There are many tutorials about it, so it is very simple, and you can ask your own AI to tell you how to do it.

2. Define the Problem

  • I have very heavy .MOV format videos
  • I need to share my videos on WhatsApp and Discord
  • The videos must maintain decent quality
  • I need to speed up the videos a little to make them shorter

3. Ask the AI to design a development brief

Wait, What is Prompt? AI Prompting is an instruction that we provide to artificial intelligence to help us solve a problem or perform a specific task.

I wrote this instruction, hoping that my AI Assistant could draft a development assignment for my AI programmer.

The Instruction

I have a problem:

- I have very heavy MOV format videos
- I need to share my videos on WhatsApp and Discord
- Videos must maintain decent quality
- I need to speed up the videos a little to make them shorter

Please help me design a step-by-step project brief so that a programmer
can develop a simple application in Python to solve my problem

The answer

Sure, I can help you with that. Here’s a step-by-step project brief for a Python application that can convert heavy MOV format videos to a more compressed format, speed them up, and maintain decent quality for sharing on WhatsApp and Discord:


Project Overview:

Develop a Python application that can process MOV format videos and convert them to a more compressed format suitable for sharing on platforms like WhatsApp and Discord.
The application should allow users to speed up the videos by a specified factor to make them shorter.
The output videos should maintain decent quality while being significantly smaller in size than the original MOV files.
Requirements:

Input: The application should accept MOV format video files as input.
Output: The application should generate compressed video files in a format suitable for sharing on WhatsApp and Discord (e.g., MP4, WebM).
Speed Adjustment: The application should allow users to specify a speed factor to increase the playback speed of the video (e.g., 1.2x, 1.5x).
Quality Control: The application should provide options to adjust the output video quality to strike a balance between file size and visual quality.
User Interface: The application should have a simple and intuitive user interface for selecting input files, adjusting settings, and initiating the conversion process.
Technical Specifications:

Programming Language: Python
Video Processing Library: Use a popular Python library like ffmpeg-python or moviepy for video processing and conversion.
User Interface Library: Consider using a Python GUI library like tkinter or PyQt for creating the user interface.
File Handling: Implement file selection and output file naming functionality.
Progress Tracking: Provide a progress indicator or status updates during the conversion process.
Implementation Steps:

Set up the project environment and install the required Python libraries.
Implement a function to read and process the input MOV video files.
Develop a function to adjust the video speed based on the user-specified speed factor.
Implement a function to convert the processed video to a compressed format suitable for sharing (e.g., MP4, WebM).
Incorporate quality control options to allow users to adjust the output video quality.
Design and implement the user interface for selecting input files, adjusting settings, and initiating the conversion process.
Integrate the video processing, speed adjustment, and conversion functions with the user interface.
Implement error handling and provide appropriate feedback to the user.
Test the application with various input videos and settings to ensure proper functionality.
Deployment and Distribution:

Package the application as an executable or distributable format for easy installation and use on different platforms.
Provide clear instructions and documentation for users on how to install and use the application.
Potential Enhancements:

Batch processing: Allow users to process multiple video files simultaneously.
Progress monitoring: Provide detailed progress information during the conversion process.
Output format selection: Allow users to choose from multiple output video formats.
Advanced settings: Provide advanced options for fine-tuning the video compression and quality settings.
By following this project brief, a programmer should be able to develop a Python application that can convert heavy MOV format videos to a more compressed format suitable for sharing on WhatsApp and Discord, while maintaining decent quality and allowing for speed adjustment to make the videos shorter.

Yes, it’s a big text, but at the end of the day it’s a development brief.

4. Developing the Application with CodeGPT

Now with my development brief ready, I submitted my request to my python expert assistant on CodeGPT, an AI platform specializing in AI coders assistants, and asked:

The Instruction
Please help me to develop this Python application. I need every time I run the application to take the most recent video from the “input” folder, process it and export it to the output folder in MP4 format.

- I want the name of the exported video to be an ID plus the date
- My folder structure is this:
- main
— app.py
— /Input
— /Output

The agent provided me with a code that had a small error. I then gave the following instruction, which resulted in a working code:

The Instruction
“Solve this issue, avoid any details, just rewrite the code with the solution. Prevent any other potential missing variable errors.”

# Code Preview

import os
from moviepy.editor import VideoFileClip, vfx
from datetime import datetime

def get_latest_file(path):
try:
files = os.listdir(path)
paths = [os.path.join(path, basename) for basename in files]
return max(paths, key=os.path.getctime)
except Exception as e:
print(f"An error occurred while getting the latest file: {str(e)}")
The Final Result: Here is the final result. In a short amount of time, I was able to create my first Python application using AI to guide me through the process. I believe this is something we should all learn to prepare for a future where programming and AI assistants will be commonplace.

...
🙋 You can get all the project code at this link
https://github.com/gustavoespindola/learnwithai/tree/main/TurboClip

🙋 You can get all the project code at this link

The original file size : 39.1MB | Final File size 4MB

I feel very proud of my progress (my AI progress), and despite having taken many programming courses, I had never made such significant progress as I did today with the help of my assistants on CodeGPT.

I hope anyone can enter the world of programming, a beautiful place where creativity knows no bounds. With the help of AI assistants, the barriers to entry have been lowered, making it easier than ever to turn your ideas into reality. So, don’t be afraid to take that first step — the future of programming is here, and it’s more accessible than ever before.

Have a good one

--

--

Gustavo Espíndola

Maker & Senior Product Designer — Co-founder of CodeGPT by Judini AI