[FFmpeg-user] Converting numerous files to h264

neoculture23 neoculture23 at gmail.com
Sat Nov 10 05:24:14 CET 2012

I have a fileserver which I have been using to store my DVD and Bluray
rips. The files were ripped using a variety of methods over time and thus
are a mixture of *.avi, *.mkv and a smattering of other containers. Most
will have an MPEG2 video stream (but some have other video codecs), one or
two audio streams, possibly a subtitle track (for foreign films) and most
(but not all) will have a chapter track.

I am looking at converting all of this mish-mash to h264 stored in MKV
containers. To that end I have written a little shell script which goes
through my fileserver and identifies files which have the "wrong" extension
or which have the wrong video codec. I wish to preserve the audio stream
as-is as well as any other non-video streams/tracks which may (or may not)
be present.

The command line I am currently looking at using is:

ffmpeg -i old_file.<ext> -c:a copy -c:s copy -c:d copy -c:t copy -c:v
libx264 -preset slower old_file.mkv

I am not worried about how long it takes to do the conversion, I just want
decent quality at the other end... and smaller files (hopefully).

Is the above command line the best way to achieve my goal? (I have tried to
understand the manual, but there are so many commands and options that I
got lost) I am happy to have it do a two-pass conversion, but I am not sure
on how to request that on the command line.

Help please?

More information about the ffmpeg-user mailing list