HTML and CSS Reference
The input video can be any format that FFmpeg supports. If you have a non-MP4 video,
replace the filename (after the -i ) with your video.
H.5. Encoding to MP4/h264 with MP3
Converting from AAC audio to MP3 isn't a common requirement for web development,
but it does allow us to demonstrate another useful feature of FFmpeg. As you already know,
h264 is a lossy codec, so re-encoding h264 at the same resolution will reduce quality. But
sometimes you may want to re-encode the audio—how can you do that without reducing
the quality of the video? Our next listing has the answer—again, type it into your command
prompt on a single line.
Listing H.4. ffmpeg command line
You can use the copy codec for several tricks like this. It's also useful if you want to convert
between container formats without re-encoding either the audio or video streams.
H.6. Encoding to WebM/VP8
It's likely that WebM will be your second most required format after MP4. With MP4 and
WebM format videos, you'll have more than 80% of desktop browser users supported and
significant mobile platforms, including iOS and Android. The next listing shows the com-
mand line for converting to the WebM format, using its associated VP8 video codec and