# MPG to MP4 — Setup guide

> Convert an MPG video to MP4. Runs on your own device.

- Language: English
- Web page: https://www.arvish.xyz/apps/mpg-to-mp4
- App code (git clone): https://github.com/Abhishek862009/mpg-to-mp4.git
- Source code: https://github.com/Abhishek862009/mpg-to-mp4

MPG to MP4 runs on your own device, not on a server. Choose your device below and follow the steps. The first setup takes a few minutes because you install a few free programs; after that, starting the app is one command.

Why an app and not a website? Browsers cannot reliably play or convert MPG files, and uploading big videos to a website is slow. On your own device the real ffmpeg program does the work, so it is fast and your video never leaves your device. The app only listens on 127.0.0.1, which means only that device can open it; other devices on your Wi-Fi cannot.

## What you need

- A Windows PC, Mac, Linux computer or an Android phone, with internet for the first setup. iPhone and iPad are not supported.
- Git, which downloads the app from GitHub. The steps below install it.
- Python 3.9 or newer. The steps below install it.
- ffmpeg, the program that does the actual conversion. The steps install it.

## Windows 10 / 11 (PowerShell or CMD)

Works in PowerShell and in Command Prompt (CMD). winget is built into Windows 10/11.

ℹ️ The converter itself was tested on Linux. These Windows steps are written from the official documentation of winget, Python and ffmpeg, and the author has not run them on a Windows PC yet. If one fails, see “If something goes wrong” below.

### Step 1: Open PowerShell or Command Prompt

Click the Start button, type PowerShell (or cmd for Command Prompt) and press Enter. A window opens. You will paste the commands below into it (Ctrl+V, or right-click). Where PowerShell and CMD differ, both versions are shown.

### Step 2: Install Git, Python and ffmpeg

Run these three lines one by one (copy a line, paste it, press Enter, wait until it finishes). They are the same in PowerShell and CMD.

```powershell
winget install -e --id Git.Git
winget install -e --id Python.Python.3.13
winget install -e --id Gyan.FFmpeg
```

If it asks you to agree to terms, type Y and press Enter. When all three are done, close the window and open it again. Windows needs this to find the new programs.

### Step 3: Check that they installed

```powershell
git --version
py --version
ffmpeg -version
```

git should show a version number, py should show Python 3.9 or higher (for example 3.13), and ffmpeg should print a few lines starting with “ffmpeg version”.

### Step 4: Get the app

This downloads the app from GitHub into a folder called mpg-to-mp4 in your user folder, and goes into it.

PowerShell:
```powershell
cd $HOME
git clone https://github.com/Abhishek862009/mpg-to-mp4.git
cd mpg-to-mp4
```

Command Prompt (CMD):
```powershell
cd %USERPROFILE%
git clone https://github.com/Abhishek862009/mpg-to-mp4.git
cd mpg-to-mp4
```

### Step 5: Set it up (first time only)

Same lines in PowerShell and CMD.

```powershell
py -m venv .venv
.venv\Scripts\python.exe -m pip install -r requirements.txt
```

This downloads the library the app needs. Wait until the prompt comes back.

### Step 6: Start the app

```powershell
.venv\Scripts\python.exe app.py
```

When the window shows “MPG to MP4 is running”, open http://127.0.0.1:5000 in your browser (on the same device). Keep the window open while you use the app.

### Step 7: Next time

You do not need to install anything again. Open PowerShell or CMD and run:

PowerShell:
```powershell
cd $HOME\mpg-to-mp4
.venv\Scripts\python.exe app.py
```

Command Prompt (CMD):
```powershell
cd %USERPROFILE%\mpg-to-mp4
.venv\Scripts\python.exe app.py
```

To stop the app, click the window and press Ctrl+C.

### If something goes wrong

- **The app says “Not enough free disk space”**
  Your file needs about 1.5 times its size free in the temporary folder. Free some space, or start the app with a folder on a drive that has more room (change the folder name to your own; the app creates it if it is missing).
  PowerShell:
  ```powershell
  $env:MPG_TEMP_DIR="D:\mpg-temp"
  .venv\Scripts\python.exe app.py
  ```

  Command Prompt (CMD):
  ```powershell
  set MPG_TEMP_DIR=D:\mpg-temp
  .venv\Scripts\python.exe app.py
  ```

- **The page opens, but converting says “ffmpeg was not found”**
  The app can only use an ffmpeg that this window can find. Stop the app (Ctrl+C), close this PowerShell or CMD window and open a new one. Run the first line: if it prints “ffmpeg version”, start the app again. If it says the command is not found, run the second line to install ffmpeg, then close the window, open a new one and start the app again.
  ```powershell
  ffmpeg -version
  winget install -e --id Gyan.FFmpeg
  ```

- **“git is not recognized”, “py is not recognized” or “ffmpeg is not recognized”**
  Close the window and open it again. If it still fails, install the program by hand from its official site: git-scm.com, python.org (tick “Add python.exe to PATH” in the installer) and ffmpeg.org (Windows builds).
- **“winget is not recognized”**
  Update “App Installer” in the Microsoft Store, or install Git, Python and ffmpeg by hand from the sites above.
- **The app says port 5000 is already in use**
  Start it on another port, then open that port in the browser (here 5001):
  PowerShell:
  ```powershell
  $env:PORT=5001
  .venv\Scripts\python.exe app.py
  ```

  Command Prompt (CMD):
  ```powershell
  set PORT=5001
  .venv\Scripts\python.exe app.py
  ```

### How to update

A newer version of the app can fix problems or add improvements. Updating takes about a minute: it gets the newest version of the app and of its library. The videos you already converted stay where they are.

#### Step 1: Stop the app

If the app is running, click its window and press Ctrl+C. The prompt comes back when it has stopped. If the app is not running, skip this step.

#### Step 2: Go to the app folder and get the newest version

git pull downloads the newest version of the app from GitHub into the folder you already have.

PowerShell:
```powershell
cd $HOME\mpg-to-mp4
git pull
```

Command Prompt (CMD):
```powershell
cd %USERPROFILE%\mpg-to-mp4
git pull
```

If it says “Already up to date.”, you already have the newest version. Otherwise it lists the files that changed.

#### Step 3: Update the libraries

```powershell
.venv\Scripts\python.exe -m pip install -U -r requirements.txt
```

It may print “Requirement already satisfied”. That is fine. Wait until the prompt comes back.

#### Step 4: Start the app again

```powershell
.venv\Scripts\python.exe app.py
```

Open http://127.0.0.1:5000 in your browser and reload the page, so the browser loads the new version.

#### If the update fails

- **git says “fatal: not a git repository”**
  This folder was not made with git clone (for example the app was downloaded as a ZIP file), so it cannot update itself. Do the “Get the app” and “Set it up” steps of the setup guide above once more, then start the app from the new folder.
- **git pull says “Your local changes to the following files would be overwritten”**
  You changed a file inside the app folder. Put your change aside, then pull again:
  ```powershell
  git stash
  git pull
  ```

## Android phone (with Termux)

Termux is a free terminal app for Android. The app runs inside it.

ℹ️ The converter itself was tested on Linux. These Termux steps are written from the Termux package lists and documentation, and the author has not run them on a phone yet. Converting on a phone is slower than on a computer, so try a short video first.

### Step 1: Install Termux from F-Droid or GitHub

Do not use the Google Play version. The Termux team says Google Play is not an official source, and that version is outdated. Download the APK from one of these two places and install it (Android may ask you to allow installs from your browser).

- Termux on F-Droid: https://f-droid.org/packages/com.termux/
- Termux releases on GitHub: https://github.com/termux/termux-app/releases

### Step 2: Open Termux and update it

```bash
pkg update
```

If it asks a question, press Enter (or type Y and press Enter).

### Step 3: Install Python, ffmpeg and Git

```bash
pkg install -y python python-pip ffmpeg git
```

### Step 4: Get the app

```bash
cd ~
git clone https://github.com/Abhishek862009/mpg-to-mp4.git
cd mpg-to-mp4
```

### Step 5: Set it up (first time only)

```bash
pip install -r requirements.txt
```

Wait until the prompt comes back. If it stops with an error, open “If something goes wrong” below.

### Step 6: Start the app

```bash
python app.py
```

When Termux shows “MPG to MP4 is running”, open Chrome (or any browser) on the same phone and go to http://127.0.0.1:5000. Keep Termux running: pull down the notification area and tap “Acquire wakelock” on the Termux notification, so Android does not put it to sleep while a video is converting.

### Step 7: Next time

```bash
cd ~/mpg-to-mp4
python app.py
```

To stop the app, press Ctrl+C in Termux (or swipe Termux away).

### If something goes wrong

- **The app says “Not enough free disk space”**
  Your file needs about 1.5 times its size free in the temporary folder. Free some space, or start the app with a folder on a drive that has more room (change the folder name to your own; the app creates it if it is missing).
  ```bash
  MPG_TEMP_DIR=$HOME/mpg-temp python app.py
  ```

- **The page opens, but converting says “ffmpeg was not found”**
  The app can only use an ffmpeg that this window can find. Stop the app (Ctrl+C), then run these lines in Termux. Run the first line: if it prints “ffmpeg version”, start the app again. If it says the command is not found, run the second line to install ffmpeg, then close the window, open a new one and start the app again.
  ```bash
  ffmpeg -version
  pkg install -y ffmpeg
  ```

- **pip says “externally-managed-environment”**
  Run the install again with one extra word:
  ```bash
  pip install --break-system-packages -r requirements.txt
  ```

- **The app stops after a while with the screen off**
  Tap “Acquire wakelock” on the Termux notification, and in Android settings set battery usage for Termux to “Unrestricted” (the wording differs by phone).
- **The app says port 5000 is already in use**
  Start it on another port, then open that port in the browser (here 5001):
  ```bash
  PORT=5001 python app.py
  ```

### How to update

A newer version of the app can fix problems or add improvements. Updating takes about a minute: it gets the newest version of the app and of its library. The videos you already converted stay where they are.

#### Step 1: Stop the app

If the app is running in Termux, press Ctrl+C in Termux. The prompt comes back when it has stopped. If the app is not running, skip this step.

#### Step 2: Go to the app folder and get the newest version

git pull downloads the newest version of the app from GitHub into the folder you already have.

```bash
cd ~/mpg-to-mp4
git pull
```

If it says “Already up to date.”, you already have the newest version. Otherwise it lists the files that changed.

#### Step 3: Update the libraries

```bash
pip install -U -r requirements.txt
```

It may print “Requirement already satisfied”. That is fine. Wait until the prompt comes back.

#### Step 4: Start the app again

```bash
python app.py
```

Open http://127.0.0.1:5000 in your browser and reload the page, so the browser loads the new version.

#### If the update fails

- **git says “fatal: not a git repository”**
  This folder was not made with git clone (for example the app was downloaded as a ZIP file), so it cannot update itself. Do the “Get the app” and “Set it up” steps of the setup guide above once more, then start the app from the new folder.
- **git pull says “Your local changes to the following files would be overwritten”**
  You changed a file inside the app folder. Put your change aside, then pull again:
  ```bash
  git stash
  git pull
  ```

- **pip says “externally-managed-environment”**
  Run the library update again with one extra word:
  ```bash
  pip install --break-system-packages -U -r requirements.txt
  ```

## Linux (Ubuntu, Debian, Fedora, Arch)

Uses the terminal. Pick the line for your distribution.

✅ The set-up, start and conversion steps were run on Linux with ffmpeg and Flask, using a test MPG file. The package-install lines (apt, dnf, pacman) are the standard ones from each distribution and were not run by the author.

### Step 1: Open a terminal

On most systems the shortcut is Ctrl+Alt+T. Otherwise search for “Terminal” in your applications.

### Step 2: Install Git, Python and ffmpeg

Ubuntu / Debian:
```bash
sudo apt update
sudo apt install -y git python3 python3-venv python3-pip ffmpeg
```

Fedora:
```bash
sudo dnf install -y git python3 python3-pip ffmpeg-free
```

Arch:
```bash
sudo pacman -S --needed git python python-pip ffmpeg
```

### Step 3: Get the app

```bash
cd ~
git clone https://github.com/Abhishek862009/mpg-to-mp4.git
cd mpg-to-mp4
```

### Step 4: Set it up (first time only)

```bash
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
```

This downloads the library the app needs. Wait until the prompt comes back.

### Step 5: Start the app

```bash
.venv/bin/python app.py
```

When the window shows “MPG to MP4 is running”, open http://127.0.0.1:5000 in your browser (on the same device). Keep the window open while you use the app.

### Step 6: Next time

```bash
cd ~/mpg-to-mp4
.venv/bin/python app.py
```

To stop the app, click the terminal window and press Ctrl+C.

### If something goes wrong

- **The app says “Not enough free disk space”**
  Your file needs about 1.5 times its size free in the temporary folder. Free some space, or start the app with a folder on a drive that has more room (change the folder name to your own; the app creates it if it is missing).
  ```bash
  MPG_TEMP_DIR=$HOME/mpg-temp .venv/bin/python app.py
  ```

- **The page opens, but converting says “ffmpeg was not found”**
  The app can only use an ffmpeg that this window can find. Stop the app (Ctrl+C), open a new terminal window. Run the first line: if it prints “ffmpeg version”, start the app again. If it says the command is not found, run the second line to install ffmpeg, then close the window, open a new one and start the app again.
  ```bash
  ffmpeg -version
  sudo apt install -y ffmpeg
  ```

- **“ensurepip is not available” when creating the virtual environment**
  On Ubuntu and Debian, install the venv package, then run the set-up lines again:
  ```bash
  sudo apt install -y python3-venv
  ```

- **The app says port 5000 is already in use**
  Start it on another port, then open that port in the browser (here 5001):
  ```bash
  PORT=5001 .venv/bin/python app.py
  ```

### How to update

A newer version of the app can fix problems or add improvements. Updating takes about a minute: it gets the newest version of the app and of its library. The videos you already converted stay where they are.

#### Step 1: Stop the app

If the app is running, click its terminal and press Ctrl+C. The prompt comes back when it has stopped. If the app is not running, skip this step.

#### Step 2: Go to the app folder and get the newest version

git pull downloads the newest version of the app from GitHub into the folder you already have.

```bash
cd ~/mpg-to-mp4
git pull
```

If it says “Already up to date.”, you already have the newest version. Otherwise it lists the files that changed.

#### Step 3: Update the libraries

```bash
.venv/bin/python -m pip install -U -r requirements.txt
```

It may print “Requirement already satisfied”. That is fine. Wait until the prompt comes back.

#### Step 4: Start the app again

```bash
.venv/bin/python app.py
```

Open http://127.0.0.1:5000 in your browser and reload the page, so the browser loads the new version.

#### If the update fails

- **git says “fatal: not a git repository”**
  This folder was not made with git clone (for example the app was downloaded as a ZIP file), so it cannot update itself. Do the “Get the app” and “Set it up” steps of the setup guide above once more, then start the app from the new folder.
- **git pull says “Your local changes to the following files would be overwritten”**
  You changed a file inside the app folder. Put your change aside, then pull again:
  ```bash
  git stash
  git pull
  ```

## Mac (macOS)

Uses Terminal and Homebrew, the standard way to install programs on a Mac.

ℹ️ The converter itself was tested on Linux. These Mac steps are written from the official Homebrew documentation and package pages, and the author has not run them on a Mac yet. If one fails, see “If something goes wrong” below.

### Step 1: Open Terminal

Press Command+Space, type Terminal and press Enter.

### Step 2: Install Homebrew (if you do not have it)

First check whether you already have it. If it prints a version number, skip the second line.

```bash
brew --version
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

The second line is the official installer from brew.sh. It explains what it will do and asks for your Mac password. When it finishes it prints “Next steps”: copy and run those lines too, so that the brew command works.

- Homebrew: https://brew.sh/

### Step 3: Install Git, Python and ffmpeg

```bash
brew install git python@3.13 ffmpeg
```

### Step 4: Get the app

```bash
cd ~
git clone https://github.com/Abhishek862009/mpg-to-mp4.git
cd mpg-to-mp4
```

### Step 5: Set it up (first time only)

```bash
python3.13 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
```

This downloads the library the app needs. Wait until the prompt comes back.

### Step 6: Start the app

```bash
.venv/bin/python app.py
```

When the window shows “MPG to MP4 is running”, open http://127.0.0.1:5000 in your browser (on the same device). Keep the window open while you use the app.

### Step 7: Next time

```bash
cd ~/mpg-to-mp4
.venv/bin/python app.py
```

To stop the app, click the Terminal window and press Control+C.

### If something goes wrong

- **The app says “Not enough free disk space”**
  Your file needs about 1.5 times its size free in the temporary folder. Free some space, or start the app with a folder on a drive that has more room (change the folder name to your own; the app creates it if it is missing).
  ```bash
  MPG_TEMP_DIR=$HOME/mpg-temp .venv/bin/python app.py
  ```

- **The page opens, but converting says “ffmpeg was not found”**
  The app can only use an ffmpeg that this window can find. Stop the app (Ctrl+C), open a new Terminal window. Run the first line: if it prints “ffmpeg version”, start the app again. If it says the command is not found, run the second line to install ffmpeg, then close the window, open a new one and start the app again.
  ```bash
  ffmpeg -version
  brew install ffmpeg
  ```

- **“brew: command not found” right after installing Homebrew**
  Run the “Next steps” lines that the Homebrew installer printed at the end, then open a new Terminal window.
- **“python3.13: command not found”**
  Open a new Terminal window and try again. If it still fails, run the install line again:
  ```bash
  brew install python@3.13
  ```

- **Port 5000 is already in use on a Mac**
  macOS can use port 5000 for AirPlay Receiver. Start the app on another port and open that port in the browser (here 5001):
  ```bash
  PORT=5001 .venv/bin/python app.py
  ```

### How to update

A newer version of the app can fix problems or add improvements. Updating takes about a minute: it gets the newest version of the app and of its library. The videos you already converted stay where they are.

#### Step 1: Stop the app

If the app is running, click its Terminal window and press Control+C. The prompt comes back when it has stopped. If the app is not running, skip this step.

#### Step 2: Go to the app folder and get the newest version

git pull downloads the newest version of the app from GitHub into the folder you already have.

```bash
cd ~/mpg-to-mp4
git pull
```

If it says “Already up to date.”, you already have the newest version. Otherwise it lists the files that changed.

#### Step 3: Update the libraries

```bash
.venv/bin/python -m pip install -U -r requirements.txt
```

It may print “Requirement already satisfied”. That is fine. Wait until the prompt comes back.

#### Step 4: Start the app again

```bash
.venv/bin/python app.py
```

Open http://127.0.0.1:5000 in your browser and reload the page, so the browser loads the new version.

#### If the update fails

- **git says “fatal: not a git repository”**
  This folder was not made with git clone (for example the app was downloaded as a ZIP file), so it cannot update itself. Do the “Get the app” and “Set it up” steps of the setup guide above once more, then start the app from the new folder.
- **git pull says “Your local changes to the following files would be overwritten”**
  You changed a file inside the app folder. Put your change aside, then pull again:
  ```bash
  git stash
  git pull
  ```

## Using the app

1. Open http://127.0.0.1:5000 in your browser.
2. Drop your .mpg or .mpeg file on the box, or click the box and choose the file.
3. Choose “Speed or quality” (Fast is best for big files) and press “Convert to MP4”. Two bars show the progress: sending the file to the app, and converting it, with percent, speed and the time left.
4. When it says “Done”, press “Download MP4”. The file goes to your browser’s Downloads folder. Then press “Delete temporary file and convert another” to free the disk space.

## Good to know

- The video is re-encoded into H.264 video and AAC audio, which is what MP4 players expect. There is no size limit, so big files of 7 to 8 GB work. The time depends on your computer: it can take from many minutes to a few hours, so keep the window open and the device awake. “Fast” is the quickest. A phone is much slower than a computer and may run out of space, so use a computer for very big files.
- The app needs free disk space of about 1.5 times the size of your file in its temporary folder (on Windows this is usually the C: drive). If space is short, the app tells you. Press “Delete temporary file and convert another” after downloading. The temporary files are also removed when you stop the app. It only takes .mpg and .mpeg files; if a file is damaged, the app says it could not convert it.
- Nothing about your videos goes through arvish.xyz. You get the app’s code from GitHub once; after that the conversion happens only on your device, and the temporary files are deleted when you press “Delete temporary file and convert another” or stop the app.
- The app is open source. The code is in its own repository on GitHub: Abhishek862009/mpg-to-mp4.
