Command Line Tools

A beginner’s guide for using command line tools from within Win7

There are quite a few tools with good Command Line Interfaces (CLI’s) but for this guide we will concentrate on three:
FFmpeg
AVConv
MEncoder

These all come with playback support as well, utilising FFplay, AVplay and Mplayer. FFprobe is the analysis tool for FFmpeg and AVprobe for AVConv.

Download the software. This bit sounds easy but if you are new to these types of Open Source software then you may be a little put off when previewing the sites. What you are looking for are ‘Windows nightly builds’. Also, there may be 32 and 64 bit versions.

FFmpeg – http://ffmpeg.zeranoe.com/builds/
Download either the 32 or 64 bit STATIC Build.

AVCONV – http://libav.org/download.html
Download either the 32 or 64 bit Windows Build.

MEncoder – https://code.google.com/p/mplayer-for-windows/downloads/list

16/05/13 MEncoder Update – I was informed today that things are now slightly different with the Windows builds. Upon checking there is a new method to compile Windows .dll codecs. I will get around to doing a new MEncoder guide but in the meantime I have placed an older version with the Codecs.conf file in by shared box. It on the Right side in the widget!!

Download the latest Binary (NOT Sourcecode).
They are all in .7z compressed format so you will need a program to un-compress them! If you have not got anything, take a look at jZip http://jzip.kayako.com/Core/Default/Index

Create a folder on your desktop called ‘CMD_Tools’
Extract each 7z folder into the CMD_Tools folder.
You now should have something like this…

cmd tools
Next, go to your Windows search bar within the start menu.
Type in cmd.exe
Right click this and select ‘Pin to Task bar’.
You will now have the Command Line application within your Task Bar.

command line shortcut
Double click this to open it.

cmd
OK, for those people who have never used the command line before – this is where things start to be a little different. You can type after the >
In order for instructions to be understood correctly, you need to be running cmd.exe from inside the correct directory. Don’t worry – it will all become clear!

In its current state I am running cmd.exe from within my user folder C:\Users\username>

In order to utilise the command line tools you downloaded, you need to change directory. The command for this is ‘cd’.

cmd-cd

In the image above I have typed cd and then the address for the bin folder, which is in the ffmpeg folder that we unzipped into the CMD_Tools folder on your desktop! Typing all that in would be a pain but you don’t have to! Win7 Cmd supports drag and drop. So just type cd, hit the space bar, then drag in the bin folder from ffmpeg. Hit Enter.

cmd-in folder

You are now in this folder! Type ffmpeg and hit enter.

cmd-ffmpeg
The ffmpeg version and librarys will then be presented, along with how to get help.
In the ffmpeg bin folder are the other connected programs of ffplay and ffprobe. As an example of their use type ffplay (space) and then drag and drop a video file. Then hit enter. Note: Make sure its reasonably standard!!
Your video should be read and it should play back in its own window.
In my example below, I played a file called UncompRGB.avi

ffplay
Let’s now have a look at AVCONV….
This is very similar to ffmpeg as they all were once together as a single program. As we are inside the ffmpeg bin directory, we need to get out of this and into the correct one.
Just type cd, hit the space bar and then drag in the bin folder that is in the usr folder inside the libav folder you downloaded….

cd avconv
To test out AVCONV, type avconv -formats

You will then be greeted by all the formats that it can deal with and details of whether it can demux or mux. D & E come from the words Decode and Encode.

avconv-formats
Lastly, let’s have a look at MEncoder….
You just need to ‘cd’ into the main folder here, as the programs are not inside another directory. Once you are in the correct directory type mencoder -ovc help

mencoder-ovc
Hopefully what you have learnt here will help you in using CLI tools.

I have deliberately used the manual route of getting into a directory by using the cd command…… now here is a neat way to tidy things up!
Close any cmd.exe windows you may have open and then cut / paste your CMD_Tools folder into the root of the C drive.
On your desktop, create a shortcut to the Cmd.exe (Right click > New > Shortcut). Cmd.exe is inside C\Windows\system32. When you are asked to type a name for the shortcut, type ‘FFmpeg’.

When the shortcut is there, right click it and select properties.

shortcut1

Go to your ffmpeg folder and select the bin folder to highlight it. Hit shift and Right Click the bin folder and chose ‘copy as path’.
You can now paste the address into the start in:

shortcut2
Click apply and then OK.
You now have a shortcut to use the CMD.exe and it will automatically open in the correct directory without the need to cd!

If anyone has any other cmd shortcuts like the one shared by Mark below then please let us know.

Advertisement
By Spreadys Posted in EEPIP

4 comments on “Command Line Tools

  1. I learned a little command line trick for Windows. If you want to open a CMD window in a particular folder location, open a ‘windows explorer’ window for that folder, then simply type ‘cmd’ and press enter into the explorer bar at the top. It saves you having to cd to the right spot on your disk.

  2. FOR %%A in (“*.avs”) DO (
    ffmpeg.exe -threads 0 -i “%%A” -f mp4 -vcodec libx264 -crf 16 -minrate 900k -maxrate 2100k -bufsize 2100k -refs 3 -preset slow -vprofile high -strict -2 -acodec aac -ac 2 -ab 192k -vf yadif,hqdn3d,unsharp=5:5:0.5,gradfun “%%~nA.MP4”
    )
    pause

  3. name and save that script as “ffmpeg.encode-2megbit-max.bat and copy the ffmpef and this script to any folders you have .avs or renamed mkv etc…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s