How to compress a video and perform AV editing in Windows?

Vishal-Kale-photo

Vishal Kale

25 Nov, 2017

There are a lot of areas, where we need to the fastest way to perform video editing. At Tudip, our Test Engineering division usually creates a movie of issues they find in applications. These movies are then uploaded to issue reporting system like Jira and other. We have a limit of uploading upto 50MB of AV. Currently, everyone uses online tools to compress the video quickly. But it’s not the fastest way to do that. So we at Tudip developed a small program in shell script using some third party tools to compress the video offline for our Test Engineers, the way they want. The video of size 100MB can be compressed upto >1 MB.

You can download the AVE build here: https://drive.google.com/open?id=184L5MN4iAaDGPLPS4EYMi4TZ0aISaSKW

It’s a small program named AVE (Audio Video Editing) basically runs on ffmpeg. It’s the most powerful open source tool used for video and image editing. For video compression and audio removal, that too offline without creating any server-clients, we can achieve this only using some scripts which can be run locally. So we created a shell script called ave which will interact with ffmpeg for performing video editing operations. But we cannot run shell scripts in Windows OS. So to run this shell script in Windows we need to install a tool named Cygwin. It’s quite easy to install and run. Cygwin provides the platform to run UNIX commands in Windows machines.

Please follow the instructions for installation

1) Firstly, extract the AVE.zip file and copy the build folder ‘AVE’ to C: drive. Now we will install ‘Cygwin’. Go to C:/AVE/folder. You will find the two setup files.

  1. Setup-x86 is for windows 32 bit OS.
  2. Setup-x86_64 is for windows 64 bit OS.

2) Double click on .exe file to initiate the installation process. Make sure you are installing the appropriate version based on your operating system. (Check your system is either 64 bit operating system or 32 bit operating system). I have downloaded 64 bit because my operating system is 64 bit. You can check your operating system by Start->Right Click on Computer->Select Properties.

Cygwin_Setup

3) Click on Next button to proceed installation.

Cygwin_Setup

4) Leave the default option selected as Install from Internet and click on Next.

5) Leave the default name Root Directory and click on Next.

6) Click on Next.

7) Click on Next again.

8) Select any download mirror and click Next. Similarly, keep on clicking next until you get this screen-

9) It will take a little longer time to download and install so please keep patient. After successfully installation, go to your desktop and double click on icon-

Or Go to Start and click on Cygwin64 Terminal option.

On this window, we will be running our ‘AVE’ program for video compression.
Also, to perform other additional operation and to work on normal Windows command prompt we need to set Cygwin path. We will also set the path for ‘ffmpeg’.

Please follow the process to set the ffmpeg path and Cygwin path to work on normal Windows command prompt.

1) Go to Start and Right Click on Computer and Select properties.

2) Click on Advanced system settings shown on left side.

3) Click on Advanced tab and then Environment Variables button.

4) Under system variables select Path and then click on Edit button.

5) In variable value at the end add or append below the line.

(ADD THE BELOW LINE STRICTLY AT THE END AS SHOWN IN BELOW PICTURE AND DO NOT REMOVE PREVIOUS VALUES)

  1. For Windows 32 bit add: ;C:\cygwin32\bin\;C:\AVE\ffmpeg-win32\bin
  2. For Windows 64 bit add: ;C:\cygwin64\bin\;C:\AVE\ffmpeg-win64\bin

6) Click OK and close all the windows opened. Now you have successfully set the path and ready to run ‘AVE’ program.

How to use AVE program to compress the video in Windows?

1. Open Cygwin64/32 Terminal which is available on your Desktop or Start menu.

2. Go to AVE directory using command

$ cd C:/AVE/

3. AVE contains 2 more folder ‘InputDIR’ and ‘OutputDIR’.

4. You have to keep all the videos which you want to compress in InputDIR and you will get the compressed video in OutputDIR.

5. Now, you can run the AVE in this folder, sample command is (filename should be with extension)

6. To reduce video file size and remove audio from it, Just Enter the file name in front of ‘./ave’

$ ./ave APP-1322.mov

7. To scale(reduce) video width: (Best widths: 320/480/640/720/800/1080)

$ ./ave APP-1033.mov 480

8. The default video scale width is 320 and the height is calculated automatically according to the current aspect ratio of the video. However, you can also give the custom scale height size.

$ ./ave APP-1033.mov 480 852

9. Also if you want little bit more reduced size, then you can also adjust the bitrate. The default bitrate is 512. Lower the bitrate, Lower the video quality and video size.

$ ./ave APP-1033.mov 480 852 1024

10. You can read more about ffmpeg and Cygwin here:

Hope you found this article useful.