diff --git a/index.html b/index.html index 6710247..849e0fc 100644 --- a/index.html +++ b/index.html @@ -250,18 +250,19 @@
ffmpeg -i input_file -c:v libx264 -pix_fmt yuv420p -c:a copy output_file
ffmpeg -i input_file -c:v libx264 -pix_fmt yuv420p -c:a aac output_file
This command takes an input file and transcodes it to H.264 with an .mp4 wrapper, keeping the audio the same codec as the original. The libx264 codec defaults to a “medium” preset for compression quality and a CRF of 23. CRF stands for constant rate factor and determines the quality and file size of the resulting H.264 video. A low CRF means high quality and large file size; a high CRF means the opposite.
In order to use the same basic command to make a higher quality file, you can add some of these presets:
-ffmpeg -i input_file -c:v libx264 -pix_fmt yuv420p -preset veryslow -crf 18 -c:a copy output_file
ffmpeg -i input_file -c:v libx264 -pix_fmt yuv420p -preset veryslow -crf 18 -c:a aac output_file
veryslow
, slower
, slow
, medium
, fast
, faster
, veryfast
, superfast
, ultrafast
.ffmpeg -i concat:input_file1\|input_file2\|input_file3 -c:v libx264 -c:a copy output_file.mp4
ffmpeg -i concat:input_file1\|input_file2\|input_file3 -c:v libx264 -c:a aac output_file.mp4
This command allows you to create an H.264 file from a DVD source that is not copy-protected.
Before encoding, you’ll need to establish which of the .VOB files on the DVD or .iso contain the content that you wish to encode. Inside the VIDEO_TS directory, you will see a series of files with names like VTS_01_0.VOB, VTS_01_1.VOB, etc. Some of the .VOB files will contain menus, special features, etc, so locate the ones that contain target content by playing them back in VLC.
-i concat:VTS_01_1.VOB\|VTS_01_2.VOB\|VTS_01_3.VOB
It’s also possible to adjust the quality of your output by setting the -crf and -preset values:
-ffmpeg -i concat:input_file1\|input_file2\|input_file3 -c:v libx264 -crf 18 -preset veryslow -c:a copy output_file.mp4
ffmpeg -i concat:input_file1\|input_file2\|input_file3 -c:v libx264 -crf 18 -preset veryslow -c:a aac output_file.mp4
Bear in mind that by default, libx264 will only encode a single video stream and a single audio stream, picking the ‘best’ of the options available. To preserve all video and audio streams, add -map parameters:
-ffmpeg -i concat:input_file1\|input_file2 -map 0:v -map 0:a -c:v libx264 -c:a copy output_file.mp4
ffmpeg -i concat:input_file1\|input_file2 -map 0:v -map 0:a -c:v libx264 -c:a aac output_file.mp4
For more information, see the FFmpeg wiki page on concatenating files.
ffmpeg -i input1.avi -i input2.mp4 -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[videoOut][audioOut]" -map "[videoOut]" -map "[audioOut]" output_file
This command takes two or more files of the different file types and joins them together to make a single file.
+However, it only works properly if the files to be combined have the same dimensions (e.g., 720x576).
+Some aspects of the input files will be normalised: for example, if an input file contains a video track and an audio track that do not have exactly the same duration, the shorter one will be padded. In the case of a shorter video track, the last frame will be repeated in order to cover the missing video; in the case of a shorter audio track, the audio stream will be padded with silence.
+Note that if the input files have different framerates, the output file will be of variable framerate.
+0:v:0
, the first zero refers to the first input file, v
means video stream, and the second zero indicates that it is the first video stream in the file that should be selected. Likewise, 0:a:0
means the first audio stream in the first input file.0
means the first input/stream/etc, 1
means the second input/stream/etc, and 4
would mean the fifth input/stream/etc.concat
filterIf no characteristics of the output files are specified, ffmpeg will use the default encodings associated with the given output file type. To specify the characteristics of the output stream(s), add flags after each -map "[out]"
part of the command.
For example, to ensure that the video stream of the output file is visually lossless H.264 with a 4:2:0 chroma subsampling scheme, the command above could be amended to include the following:
+ -map "[videoOut]" -c:v libx264 -pix_fmt yuv420p -preset veryslow -crf 18
Likewise, to encode the output audio stream as mp3, the command could include the following:
+ -map "[audioOut]" -c:a libmp3lame -dither_method modified_e_weighted -qscale:a 2
For more information, see the FFmpeg wiki page on concatenating files of different types.
+ +yadif=1
may produce visually better results.