[FFmpeg-user] Converting numerous files to h264

Francois Visagie francois.visagie at gmail.com
Sat Nov 10 08:13:09 CET 2012


> -----Original Message-----
> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> bounces at ffmpeg.org] On Behalf Of neoculture23
> Sent: 10 November 2012 06:24
> To: ffmpeg-user at ffmpeg.org
> Subject: [FFmpeg-user] Converting numerous files to h264
> I have a fileserver which I have been using to store my DVD and Bluray
> 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
> 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
> 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
> my fileserver and identifies files which have the "wrong" extension or
> have the wrong video codec. I wish to preserve the audio stream as-is as
> 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
> 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?

For two-pass encoding you need to run the command line twice. IIRC once with
'-pass 1' and once more with '-pass 2'.

Regarding quality, you can definitely look at video bitrate. See what is
implied/specified by 'libx264 -preset slower', perhaps decide on a different
bitrate and then specify that with '-b:v'.

More information about the ffmpeg-user mailing list