Complete Project Setup Guide: Installing FFmpeg, PortAudio, and Setting Up Python Environments 

Setting up your project environment can be a breeze with the right guidance. This blog post walks you through installing FFmpeg and PortAudio on macOS, Linux, and Windows, and setting up a Python virtual environment using Pipenv, pip, or conda. Let’s dive in!


Table of Contents

  1. Installing FFmpeg and PortAudio
    • macOS
    • Linux
    • Windows
  2. Setting Up a Python Virtual Environment
    • Using Pipenv
    • Using pip and venv
    • Using Conda
  3. Running the Application

Installing FFmpeg and PortAudio

macOS

  1. Install Homebrew (if not already installed):
    bash

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install FFmpeg and PortAudio:
    bash

    brew install ffmpeg portaudio

Linux

For Debian-based distributions like Ubuntu:

  1. Update the package list:
    bash

    sudo apt update
  2. Install FFmpeg and PortAudio:
    bash

    sudo apt install ffmpeg portaudio19-dev

Windows

  1. Download FFmpeg:

    • Visit the FFmpeg download page.
    • Navigate to the Windows builds section and download the latest static build.
  2. Extract and Set Up FFmpeg:

    • Extract the ZIP file to a folder (e.g., C:\ffmpeg).
    • Add the bin directory to your system’s PATH:
      • Search for Environment Variables in the Start menu.
      • Edit the system’s Path variable, and add C:\ffmpeg\bin.
  3. Install PortAudio:

    • Download PortAudio binaries from the official website.
    • Follow the installation instructions provided on the site.

Setting Up a Python Virtual Environment

Using Pipenv

  1. Install Pipenv:
    bash

    pip install pipenv
  2. Install Dependencies:
    bash

    pipenv install
  3. Activate the Virtual Environment:
    bash

    pipenv shell

Using pip and venv

  1. Create a Virtual Environment:
    bash
    python -m venv venv
  2. Activate the Virtual Environment:
    • macOS/Linux:
      bash

      source venv/bin/activate
    • Windows:
      bash

      venv\Scripts\activate
  3. Install Dependencies:
    bash

    pip install -r requirements.txt

Using Conda

  1. Create a Conda Environment:
    bash

    conda create --name myenv python=3.11
  2. Activate the Conda Environment:
    bash

    conda activate myenv
  3. Install Dependencies:
    bash

    pip install -r requirements.txt

Running the Application

Once your environment is set up, follow these steps to run each project phase:

  1. Phase 1: Brain of the Doctor
    bash

    python brain_of_the_doctor.py
  2. Phase 2: Voice of the Patient
    bash

    python voice_of_the_patient.py
  3. Phase 3: Voice of the Doctor
    bash

    python voice_of_the_doctor.py
  4. Phase 4: Gradio UI Setup
    bash

    python gradio_app.py

By following these steps, you'll have your project environment up and running smoothly, ready to tackle each phase with ease. Happy coding! 😊