Building FFmpeg for Windows on Linux – Part 1 – Setting Up the Virtual Environment



Building FFmpeg for Windows on Linux – Part 1 – Setting Up the Virtual Environment

The first part of this tutorial will cover setting up the virtual instance of Ubuntu 10.10 on a Windows 7 64-bit laptop using VirtualBox.  The steps below will outline the entire process to get your virtual evironment ready to compile FFmpeg.

  1. Download and install VirtualBox for Windows hosts
    http://www.virtualbox.org/wiki/Downloads
  2. Download Ubuntu Desktop Edition 10.10 64-bit ISO
    http://www.ubuntu.com/desktop/get-ubuntu/download
  3. Create a new VirtualBox virtual machine and install Ubuntu from the downloaded ISO
    • VM Name and OS Type
      • Name: Ubuntu 10.10
      • Operating System: Linux
      • Version: Ubuntu (64 bit)
    • Memory: 512 MB (Default) – I increased this to speed up the process a bit.  If you have more RAM to allocate to this VM, go ahead and do so.
    • Virtual Hard Disk
      • Boot Hard Disk: Checked
      • Create new hard disk: Selected
        • Storage Type: Dynamically expanding storage
        • Virtual Disk Location: Default
        • Virtual Disk Size: 8.00 GB (at least 6 GB is recommended)
    • Add the Ubuntu ISO as a CD Drive
      1. Select the newly created VM and click Settings
      2. In the Settings dialog, select Storage from the left side menu
      3. In the Storage Tree, select Empty under IDE Controller, then click the folder icon to the right of the CD/DVD Device drop-down to open the Virtual Media Manager
      4. Click the Add button to add the Ubuntu 10.10 ISO that you downloaded above
      5. Select the ISO that you just added and click the Select button
      6. Verify that the ISO has been added to the CD/DVD Device and click the OK button to close the Settings dialog and accept the changes.
    • Start the VM and follow the Ubuntu installation instructions
      1. When Ubuntu first loads from the CD (ISO), it will prompt you to either Try Ubuntu or Install.  Select Install.
      2. Preparing to install Ubuntu
        • Download updates while installing: Unchecked.  We will install updates after the installation
        • Install this third-party software: Unchecked.  This is not necessary for our purposes.
      3. Allocate drive space: Erase and use the entire disk (use defaults on next screen [select drive])
      4. Click the Install Now button
      5. During installation, select the appropriate options for timezone and keyboard layout
      6. Who are you? Create a username and password, be sure to either write down this information or remember it so you can login to Ubuntu later.
      7. Sit back and wait for Ubuntu to finish installing, it takes about 10-15 minutes depending on the allocated resources of the VM.
      8. Once the installation has finished, you’ll be prompted to restart.  Go ahead and restart, and if it prompts you to remove installation media, do so by opening the menu Devices -> CD/DVD Devices and click Ubuntu 10.10 ISO to un-check it.
      9. After restart, login to Ubuntu with the username/password entered during installation
  4. Run all Ubuntu updates, either via Update Manager or apt-get.  Either option will take some time to download and install updates.  Get and install updates until there are no updates left.
    • Update Manager
      1. Open the Update Manager in Ubuntu under the System -> Administration menu (it may open automatically after having been logged in for a minute)
      2. When the Update Manager opens, click the Install Updates button and enter your password when prompted to Authenticate
      3. Wait for the updates to install, this may take several minutes
      4. After the updates are installed, restart and log back in
    • apt-get
      Open a terminal (Applications -> Accessories -> Terminal) and enter the following commands

      ~$ sudo apt-get update
      ~$ (output removed)
      ~$ sudo apt-get upgrade
      ~$ (output removed)
  5. Install VM Additions – this will make it a little easier to interact with your guest operating system
    1. In the VM host window, select Devices -> Install Guest Additions… to “insert” the VM Additions Cd into the VM
    2. Mount the CD in the guest VM by selecting Places -> VBOXADDITIONS_x.x.xx_xxxxx
    3. This should cause a “Places” window to open which indicates “The media has been detected as ‘UNIX software’.  Click the Open Autorun Prompt, then click the Run button when prompted to confirm
    4. Enter your password if prompted to perform administrative tasks and click the OK button
    5. VM addittions will open a new terminal window and be uncompressed, built and installed
    6. When it is finished, press Return (Enter) to close the build window
    7. Restart to finish enabling VM additions
    8. After restarting and logging back in, you can “eject” the VM additions CD by right-clicking the desktop icon, and selecting Eject, then under the VM host window, select Devices -> CD/DVD -> VBoxGuestAdditions.iso to un-check the ISO.
Your virtual instance of Ubuntu has now been installed and updated.  At this point, you can do with it what you like.  In the next part of this series, I will cover the steps needed to set up the build environment and all required libraries for FFmpeg.