How to convert media files using FFmpeg

Introduction
ffmpeg by itself is a simple media converter.

simple steps

 * 1) Grab FFmpeg. It's free. Download ffmpeg for Windows: http://FFmpeg.Zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.7z
 * 2) Run "ffmpeg -i (input/source media file) (newfile)" ; e.g.: " "

convert audio to MP3
It is possible to convert the audio of a video that you downloaded (or any audio file, for that matter) to .mp3 for listening on a portable audio device.

How to convert media files using FFmpeg is an article / guide on this very website (wiki).

Simply: ffmpeg -i audio.aac -acodec mp3 -ac 2 -ab 160 audio.mp3 ( from: http://raspberrypi.stackexchange.com/questions/14268/converting-aac-to-mp3 See, in particular: jfreak53's posting to the thread.)

ffmpeg -i audio.aac -acodec libmp3lame audio.mp3 ( source: http://linuxconfig.org/ffmpeg-audio-format-conversions#h1-4-1-aac-to-mp3 )

to and from other formats
Many audio player devices support compression algorithms (formats) (encodings) other than .mp3

such as
 * Windows Media Audio (.wma)
 * (.aac) AAC Advanced Audio Codec for iPods) using FFmpeg)
 * maybe even FLAC, in a few cases. (Free Lossless Audio Codec).

"ffmpeg audio format conversions" provides many command line examples for conversion from many combinations of different video and audio encodings.

FFmpeg

extract media streams
Video files usually are container files that, in turn, contain at least one stream of media content. Typically, there are two streams: one video stream, and one audio stream. The contents of these streams (these bitstreams) can easily be extracted and saved as separate individual files.

FFmpeg can also re-mux (re-multiplex) those individual streams into an integrated container file for playback.

ffmpeg -i audiofile.wav -i videofile.ogv -acodec copy -vcodec copy destination-new-muxed-video-filename.ogv

In the case of DVDs, for example,

More than one concurrent simultaneous audio track (different language dialogue, alternate soundtrack  music,  Director's commentary, surround sound mix)  can comprise multiple streams of audio that are contained by one given individual container multimedia file (such as VOB files on video DVDs, and .mp4 containers, or .mkv).

Also, the DVD format spec allows for the possibility of simultaneous camera feeds (angles) that can be chosen by the viewer of the DVD. Most DVDs don't have this content, but if they do - this is achieved by having more than one paralell/simultaneous/concurrent video streams enclosed within one container file.

Extract video stream from original container file and store it in a seperate, new video-only file (with no audio). ffmpeg -i original-video-container-file.mp4 -an -vcodec copy video-only.mp4

Tips
Don't necessarily rely on the package of "FFmpeg" that ships with Ubuntu, for example. Seek out 3rd-party packages (builds) of FFmpeg.

derivatives from the codebase
It is possible to compile FFmpeg from sources (the source code of the project). This may be advisable since some binaries (builds/ distributions) of FFmpeg can be crippled, like the one provided by Ubuntu. <-- That is because of the LibAV fork of FFmpeg's codebase. See below:.

You may notice that FFmpeg('s codebase) is used in (/ powers / serves as the basis of) some proprietary video converters. This is in violation of GPL because the source code of that derivative software is not, itself, made available (open source).

But don't worry about licenses! That doesn't make FFmpeg any less relevant or beneficial.

related software
MeEcoder is part of the mplayer package and software project. MEncoder is sibling software to MPlayer.

FFmpeg (in library form, as well as the binary self-executable programm/app), as well as MEncoder and MPlayer, and VLC all use  libavcodec (Lib AV Codec open source library) at their cores.

FORK: This library (which basically is the FFmpeg project,) was forked by Ubuntu/Debian into Libav. (Lib A.V.)

FFmpeg can actually use LAME and FLAC encoding libraries to convert into those formats.

There is a command-line version of lame (the LAME encoder project), as well. LAME

FLAC is the Free Lossless Audio Codec. A command-line app (program) "flac</tt>" exists (see man page)


 * List of hardware and software that supports FLAC

internal articles

 * How to reduce the size of every video in a directory
 * How to rip DVDs with mencoder.
 * Install NVIDIA Drivers on Ubuntu