Copying streams is faster
Your first example is simply copying the streams and then relocating the moov atom. This relocation allows a video to begin playback before it is completely downloaded such as a viewer watching your video via browser.
ffmpeg -i input.mp4 -codec copy -map 0 -movflags +faststart output.mp4
Encoding is slower
Encoding, as in your second example, can take a long time depending on several factors including: the complexity and duration of your input, how your ffmpeg and x264 builds were compiled, the age of your builds (potential lack of features, improvements, and bug fixes), your CPU, the encoder used, and your encoding settings. Not all of these can be controlled, but you can make sure you're using a recent build and you can change your encoding settings to better fit your needs.
Getting FFmpeg
Static builds are easy to use: just download, extract, and run. See the FFmpeg Download page for options for Linux, Windows, and OS X users. You can also compile and several step-by-step FFmpeg compile guides are available.
Using a preset
You can use a faster encoding preset when encoding with x264:
ffmpeg -i in.wmv -codec:v libx264 -preset fast -movflags +faststart out.mp4
A preset is a collection of options that determine the encoding efficiency and therefore will also affect the speed. Current presets are: ultrafast
, superfast
, veryfast
, faster
, fast
, medium
, slow
, slower
, veryslow
, placebo
. The default is medium
, and placebo
is a waste of time. General recommendation is to simply use the slowest preset that you have patience for. See the FFmpeg and x264 Encoding Guide for more information.
The -f mp4
is unnecessary and depending on your ffmpeg version h264
can work as an encoder name it is convention to use libx264
.