diff --git a/index.html b/index.html index 8d56d6a..9920029 100644 --- a/index.html +++ b/index.html @@ -42,7 +42,9 @@
Click one of the following categories to see possible commands of that type:
+Click one of the following categories to see commands of that type:
+ + @@ -50,7 +52,8 @@ - + + @@ -61,6 +64,75 @@It may not be possible to rewrap a file's contents to a new container without re-encoding one or more of the streams within (that is, the video, audio, and subtitle tracks). Some containers can only contain streams of a certain encoding type: for example, the .mp4 container does not support uncompressed audio tracks. (In practice .mp4 goes hand-in-hand with a H.264-encoded video stream and an AAC-encoded video stream, although other types of video and audio streams are possible). Another example is that the Matroska container does not allow data tracks; see the MKV to MP4 recipe.
-In such cases, ffmpeg will throw an error. If you encounter errors of this kind, you may wish to consult the list of transcoding recipes.
+In such cases, FFmpeg will throw an error. If you encounter errors of this kind, you may wish to consult the list of transcoding recipes.
-vf
is an alias for -filter:v
..mov
.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
veryslow
, slower
, slow
, medium
, fast
, faster
, veryfast
, superfast
, ultrafast
.-pix_fmt yuv420p
), the scale ranges between 0-51, with 0 being lossless and 51 the worst possible quality.libx264
will use a default value of 23. 18 is often considered a “visually lossless” compression.For more information, see the FFmpeg and H.264 Encoding Guide on the ffmpeg wiki.
+For more information, see the FFmpeg and H.264 Encoding Guide on the FFmpeg wiki.
@@ -234,11 +306,11 @@ffmpeg -i input_file -map 0 -dn -c:v ffv1 -level 3 -g 1 -slicecrc 1 -slices 16 -c:a copy output_file.mkv -f framemd5 -an framemd5_output_file
This will losslessly transcode your video with the FFV1 Version 3 codec in a Matroska container. In order to verify losslessness, a framemd5 of the source video is also generated. For more information on FFV1 encoding, try the ffmpeg wiki.
+This will losslessly transcode your video with the FFV1 Version 3 codec in a Matroska container. In order to verify losslessness, a framemd5 of the source video is also generated. For more information on FFV1 encoding, try the FFmpeg wiki.
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
ffmpeg -i input_file -c:v libx265 -pix_fmt yuv420p -c:a copy output_file
This command takes an input file and transcodes it to H.265/HEVC in an .mp4 wrapper, keeping the audio codec the same as in the original file.
-Note: ffmpeg must be compiled with libx265, the library of the H.265 codec, for this script to work. (Add the flag --with-x265
if using the brew install ffmpeg
method).
Note: FFmpeg must be compiled with libx265, the library of the H.265 codec, for this script to work. (Add the flag --with-x265
if using the brew install ffmpeg
method).
The libx265 encoding library defaults to a ‘medium’ preset for compression quality and a CRF of 28. CRF stands for ‘constant rate factor’ and determines the quality and file size of the resulting H.265 video. The CRF scale ranges from 0 (best quality [lossless]; largest file size) to 51 (worst quality; smallest file size).
@@ -345,7 +391,7 @@To create a higher quality file, you can add these presets:
ffmpeg -i input_file -c:v libx265 -pix_fmt yuv420p -preset veryslow -crf 18 -c:a copy output_file
bt601
(Rec.601), smpte170m
(Rec.601, 525-line/NTSC version), bt470bg
(Rec.601, 625-line/PAL version), bt709
(Rec.709), and bt2020
(Rec.2020).-vf colormatrix=bt601:bt709
.Note: Converting between colourspaces with ffmpeg can be done via either the colormatrix or colorspace filters, with colorspace allowing finer control (individual setting of colourspace, transfer characteristics, primaries, range, pixel format, etc). See this entry on the ffmpeg wiki, and the ffmpeg documentation for colormatrix and colorspace.
+Note: Converting between colourspaces with FFmpeg can be done via either the colormatrix or colorspace filters, with colorspace allowing finer control (individual setting of colourspace, transfer characteristics, primaries, range, pixel format, etc). See this entry on the FFmpeg wiki, and the FFmpeg documentation for colormatrix and colorspace.
ffmpeg -i input_file -c:v libx264 -vf colormatrix=src:dst -color_primaries val -color_trc val -colorspace val output_file
⚠ Using this command it is possible to add Rec.709 tags to a file that is actually Rec.601 (etc), so apply with caution!
These commands are relevant for H.264 and H.265 videos, encoded with libx264
and libx265
respectively.
Note: If you wish to embed colourspace metadata without changing to another colourspace, omit -vf colormatrix=src:dst
. However, since it is libx264
/libx265
that writes the metadata, it’s not possible to add these tags without reencoding the video stream.
For all possible values for -color_primaries
, -color_trc
, and -colorspace
, see the ffmpeg documentation on codec options.
For all possible values for -color_primaries
, -color_trc
, and -colorspace
, see the FFmpeg documentation on codec options.
1. Out of step with the regular pattern, -color_trc
doesn’t accept bt470bg
; it is instead here referred to directly as gamma.
In the Rec.601 standard, 525-line/NTSC and 625-line/PAL video have assumed gammas of 2.2 and 2.8 respectively. ↩
Other properties may be clarified in a similar way. Replace -aspect and its value with other properties such as shown in the options below. Note that setting color values in QuickTime requires that -movflags write_colr is set.
The possible values for -color_primaries
, -color_trc
, and -field_order
are given in the Codec Options section of the FFmpeg docs - scroll down to near the bottom of the section.
ffmpeg -f concat -i mylist.txt -c copy output_file
This command takes two or more files of the same file type and joins them together to make a single file. All that the program needs is a text file with a list specifying the files that should be joined. However, it only works properly if the files to be combined have the exact same codec and technical specifications. Be careful, ffmpeg may appear to have successfully joined two video files with different codecs, but may only bring over the audio from the second file or have other weird behaviors. Don’t use this command for joining files with different codecs and technical specs and always preview your resulting video file!
+This command takes two or more files of the same file type and joins them together to make a single file. All that the program needs is a text file with a list specifying the files that should be joined. However, it only works properly if the files to be combined have the exact same codec and technical specifications. Be careful, FFmpeg may appear to have successfully joined two video files with different codecs, but may only bring over the audio from the second file or have other weird behaviors. Don’t use this command for joining files with different codecs and technical specs and always preview your resulting video file!
file './first_file.ext'
file './second_file.ext'
@@ -646,7 +723,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file-c copy- use stream copy mode to re-mux instead of re-encode
- output_file
- path, name and extension of the output file
For more information, see the ffmpeg wiki page on concatenating files.
+For more information, see the FFmpeg wiki page on concatenating files.
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_fileffmpegStarts the command.
-i input_file Takes in a normal file.
-c copy Use stream copy mode to re-mux instead of re-encode.
- -map 0 Tells ffmpeg to map all streams of the input to the output.
- -f segment Use segment muxer for generating the output.
+ -map 0 tells FFmpeg to map all streams of the input to the output.
+ -f segment Use segment muxer for generating the output.
-segment_time 60 Set duration of each segment (in seconds). This example creates segments with max. duration of 60s each.
-reset_timestamps 1 Reset timestamps of each segment to 0. Meant to ease the playback of the generated segments.
output_file-%03d.mkv
Path, name and extension of the output file.
- In order to have an incrementing number in each segment filename, FFmpeg supports printf-style syntax for a counter.
+ In order to have an incrementing number in each segment filename, FFmpeg supports printf-style syntax for a counter.
In this example, '%03d' means: 3-digits, zero-padded
Examples:
@@ -705,8 +782,8 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file-ss 00:02:00- sets in point at 00:02:00
- -to 00:55:00
- sets out point at 00:55:00
- -c copy
- use stream copy mode (no re-encoding)
- - -map 0
- Tells ffmpeg to map all streams of the input to the output.
- Note: watch out when using -ss
with -c copy
if the source is encoded with an interframe codec (e.g., H.264). Since ffmpeg must split on i-frames, it will seek to the nearest i-frame to begin the stream copy.
+ -map 0 tells FFmpeg to map all streams of the input to the output.
+ Note: watch out when using -ss
with -c copy
if the source is encoded with an interframe codec (e.g., H.264). Since FFmpeg must split on i-frames, it will seek to the nearest i-frame to begin the stream copy.
output_file path, name and extension of the output file
Variation: trim video by setting duration, by using -t
instead of -to
@@ -734,9 +811,9 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file
ffmpeg starts the command
-i input_file path, name and extension of the input file
- -t 5 Tells ffmpeg to stop copying from the input file after a certain time, and specifies the number of seconds after which to stop copying. In this case, 5 seconds is specified.
+ -t 5 tells FFmpeg to stop copying from the input file after a certain time, and specifies the number of seconds after which to stop copying. In this case, 5 seconds is specified.
-c copy use stream copy mode to re-mux instead of re-encode
- -map 0 Tells ffmpeg to map all streams of the input to the output.
+ -map 0 tells FFmpeg to map all streams of the input to the output.
output_file path, name and extension of the output file
@@ -758,9 +835,9 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file
ffmpeg starts the command
-i input_file path, name and extension of the input file
- -ss 5 Tells ffmpeg what timecode in the file to look for to start copying, and specifies the number of seconds into the video that ffmpeg should start copying. To be more specific, you can use timecode such as 00:00:05.
+ -ss 5 tells FFmpeg what timecode in the file to look for to start copying, and specifies the number of seconds into the video that FFmpeg should start copying. To be more specific, you can use timecode such as 00:00:05.
-c copy use stream copy mode to re-mux instead of re-encode
- -map 0 Tells ffmpeg to map all streams of the input to the output.
+ -map 0 tells FFmpeg to map all streams of the input to the output.
output_file path, name and extension of the output file
@@ -781,10 +858,10 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_fileThis command copies a video file starting from a specified time before the end of the file, removing everything before from the output. This can be used to create an excerpt, or extract content from the end of a video file (e.g. for extracting the closing credits).
- ffmpeg
- starts the command
- - -sseof -5
- This parameter must stay before the input file. It tells ffmpeg what timecode in the file to look for to start copying, and specifies the number of seconds from the end of the video that ffmpeg should start copying. The end of the file has index 0 and the minus sign is needed to reference earlier portions. To be more specific, you can use timecode such as -00:00:05. Note that in most file formats it is not possible to seek exactly, so ffmpeg will seek to the closest point before.
+ - -sseof -5
- This parameter must stay before the input file. It tells FFmpeg what timecode in the file to look for to start copying, and specifies the number of seconds from the end of the video that FFmpeg should start copying. The end of the file has index 0 and the minus sign is needed to reference earlier portions. To be more specific, you can use timecode such as -00:00:05. Note that in most file formats it is not possible to seek exactly, so FFmpeg will seek to the closest point before.
- -i input_file
- path, name and extension of the input file
- -c copy
- use stream copy mode to re-mux instead of re-encode
- - -map 0
- Tells ffmpeg to map all streams of the input to the output.
+ - -map 0
- tells FFmpeg to map all streams of the input to the output.
- output_file
- path, name and extension of the output file
@@ -807,8 +884,8 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_fileUpscaled, Pillar-boxed HD H.264 Access Files from SD NTSC source
ffmpeg -i input_file -c:v libx264 -filter:v "yadif, scale=1440:1080:flags=lanczos, pad=1920:1080:(ow-iw)/2:(oh-ih)/2, format=yuv420p" output_file
- - ffmpeg
- Calls the program ffmpeg
- - -i
- for input video file and audio file
+ - ffmpeg
- starts the command
+ - -i input_file
- path, name and extension of the input file
- -c:v libx264
- encodes video stream with libx264 (h264)
- "
- quotation mark to start filtergraph
- yadif
- deinterlacing filter (‘yet another deinterlacing filter’)
@@ -839,7 +916,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file
- ffmpeg
- starts the command
- -i input file
- path, name and extension of the input file
- - -c:v libx264
- tells ffmpeg to encode the video stream as H.264
+ - -c:v libx264
- tells FFmpeg to encode the video stream as H.264
- -vf
- video filtering will be used (
-vf
is an alias of -filter:v
)
- "
- start of filtergraph (see below)
- yadif
- deinterlacing filter (‘yet another deinterlacing filter’)
@@ -850,9 +927,9 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file"- end of filtergraph
- output file
- path, name and extension of the output file
- "yadif,format=yuv420p"
is an ffmpeg filtergraph. Here the filtergraph is made up of one filter chain, which is itself made up of the two filters (separated by the comma).
+
"yadif,format=yuv420p"
is an FFmpeg filtergraph. Here the filtergraph is made up of one filter chain, which is itself made up of the two filters (separated by the comma).
The enclosing quote marks are necessary when you use spaces within the filtergraph, e.g. -vf "yadif, format=yuv420p"
, and are included above as an example of good practice.
- Note: ffmpeg includes several deinterlacers apart from yadif: bwdif, w3fdif, kerndeint, and nnedi.
+ Note: FFmpeg includes several deinterlacers apart from yadif: bwdif, w3fdif, kerndeint, and nnedi.
For more H.264 encoding options, see the latter section of the encode H.264 command.
Example
@@ -882,11 +959,11 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file-c:v libx264encode video as H.264
-vf "fieldmatch,yadif,decimate" applies these three video filters to the input video.
Fieldmatch is a field matching filter for inverse telecine - it reconstructs the progressive frames from a telecined stream.
- Yadif (‘yet another deinterlacing filter’) deinterlaces the video. (Note that ffmpeg also includes several other deinterlacers).
+ Yadif (‘yet another deinterlacing filter’) deinterlaces the video. (Note that FFmpeg also includes several other deinterlacers).
Decimate deletes duplicated frames.
output file path, name and extension of the output file
- "fieldmatch,yadif,decimate"
is an ffmpeg filtergraph. Here the filtergraph is made up of one filter chain, which is itself made up of the three filters (separated by commas).
+
"fieldmatch,yadif,decimate"
is an FFmpeg filtergraph. Here the filtergraph is made up of one filter chain, which is itself made up of the three filters (separated by commas).
The enclosing quote marks are necessary when you use spaces within the filtergraph, e.g. -vf "fieldmatch, yadif, decimate"
, and are included above as an example of good practice.
Note that if applying an inverse telecine procedure to a 29.97i file, the output framerate will actually be 23.976fps.
This command can also be used to restore other framerates.
@@ -997,7 +1074,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file:divides between options of the same filter
reset=1 tells the filter to calculate the stats on every frame (increasing this number would calculate stats for groups of frames)
, comma divides one filter in the chain from another
- adrawgraph=lavfi.astats.Overall.Peak_level:max=0:min=-30.0 draws a graph using the overall peak volume calculated by the astats filter. It sets the max for the graph to 0 (dB) and the minimum to -30 (dB). For more options on data points that can be graphed see the ffmpeg astats documentation
+ adrawgraph=lavfi.astats.Overall.Peak_level:max=0:min=-30.0 draws a graph using the overall peak volume calculated by the astats filter. It sets the max for the graph to 0 (dB) and the minimum to -30 (dB). For more options on data points that can be graphed see the FFmpeg astats documentation
size=700x256:bg=Black sets the background color and size of the output
[out] ends the filterchain and sets the output
" quotation mark to end the lavfi filtergraph
@@ -1081,7 +1158,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file
ffmpeg starts the command
-i input01 -i input02 Designates the files to use for inputs one and two respectively
- -filter_complex Lets ffmpeg know we will be using a complex filter (this must be used for multiple inputs)
+ -filter_complex Lets FFmpeg know we will be using a complex filter (this must be used for multiple inputs)
" quotation mark to start filtergraph
[0:v:0]tblend=all_mode=difference128[a] Applies the tblend filter (with the settings all_mode and difference128) to the first video stream from the first input and assigns the result to the output [a]
[1:v:0]tblend=all_mode=difference128[b] Applies the tblend filter (with the settings all_mode and difference128) to the first video stream from the second input and assigns the result to the output [b]
@@ -1090,7 +1167,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file-map [out]Maps the output of the filter chain
-f nut Sets the format for the output video stream to Nut
-c:v rawvideo Sets the video codec of the output video stream to raw video
- - Tells ffmpeg that the output will be piped to a new command (as opposed to a file)
+ - tells FFmpeg that the output will be piped to a new command (as opposed to a file)
| Tells the system you will be piping the output of the previous command into a new command
ffplay - Starts ffplay and tells it to use the pipe from the previous command as its input
@@ -1118,7 +1195,6 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_filePull specs from video file
ffprobe -i input_file -show_format -show_streams -show_data -print_format xml
This command extracts technical metadata from a video file and displays it in xml.
- ffmpeg documentation on ffprobe (full list of flags, commands, www.ffmpeg.org/ffprobe.html)
- ffprobe
- starts the command
- -i input_file
- path, name and extension of the input file
@@ -1127,6 +1203,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file-show_data- adds a short “hexdump” to show_streams command output
- -print_format
- Set the output printing format (in this example “xml”; other formats include “json” and “flat”)
+ See also the FFmpeg documentation on ffprobe for a full list of flags, commands, and options.
@@ -1159,45 +1236,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file
- Generate image files from a video
-
-
-
-
-
-
-
-
-
+ Generate image files from a video
@@ -1245,6 +1284,74 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file
+
+
+ Create an animated GIF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Create a video from images
@@ -1347,7 +1454,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_fileffmpegstarts the command
-i input_video_file path, name and extension of the input video file
-i input_image_file path, name and extension of the image file
- -filter_complex overlay=main_w-overlay_w-5:5 This calls the overlay filter and sets x and y coordinates for the position of the watermark on the video. Instead of hardcoding specific x and y coordinates, main_w-overlay_w-5:5
uses relative coordinates to place the watermark in the upper right hand corner, based on the width of your input files. Please see the ffmpeg documentation for more examples.
+ -filter_complex overlay=main_w-overlay_w-5:5 This calls the overlay filter and sets x and y coordinates for the position of the watermark on the video. Instead of hardcoding specific x and y coordinates, main_w-overlay_w-5:5
uses relative coordinates to place the watermark in the upper right hand corner, based on the width of your input files. Please see the FFmpeg documentation for more examples.
output_file path, name and extension of the output file
@@ -1426,7 +1533,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_fileCalculate Loudness Levels
ffmpeg -i input_file -af loudnorm=print_format=json -f null -
This filter calculates and outputs loudness information in json about an input file (labeled input) as well as what the levels would be if loudnorm were applied in its one pass mode (labeled output). The values generated can be used as inputs for a 'second pass' of the loudnorm filter allowing more accurate loudness normalization than if it is used in a single pass.
- These instructions use the loudnorm defaults, which align well with PBS recommendations for target loudness. More information can be found at the loudnorm documentation.
+ These instructions use the loudnorm defaults, which align well with PBS recommendations for target loudness. More information can be found at the loudnorm documentation.
Information about PBS loudness standards can be found in the PBS Technical Operating Specifications document. Information about EBU loudness standards can be found in the EBU R 128 recommendation document.
- ffmpeg
- starts the command
@@ -1530,14 +1637,14 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file