diff --git a/css/css.css b/css/css.css index 0b560cf..1658f06 100644 --- a/css/css.css +++ b/css/css.css @@ -150,6 +150,13 @@ img { text-align: center; } +.sample-image-small { + margin: 0 auto; + margin-bottom: 18px; + max-width: 250px; + text-align: center; +} + div { font-family: 'Merriweather', serif; color: white; diff --git a/img/crop_example_aftercrop1.png b/img/crop_example_aftercrop1.png new file mode 100644 index 0000000..e0dff12 Binary files /dev/null and b/img/crop_example_aftercrop1.png differ diff --git a/img/crop_example_aftercrop2.png b/img/crop_example_aftercrop2.png new file mode 100644 index 0000000..326bd2f Binary files /dev/null and b/img/crop_example_aftercrop2.png differ diff --git a/img/crop_example_aftercrop3.png b/img/crop_example_aftercrop3.png new file mode 100644 index 0000000..008e27a Binary files /dev/null and b/img/crop_example_aftercrop3.png differ diff --git a/img/crop_example_orig.png b/img/crop_example_orig.png new file mode 100644 index 0000000..a098a9b Binary files /dev/null and b/img/crop_example_orig.png differ diff --git a/index.html b/index.html index 46195e7..cbeed67 100644 --- a/index.html +++ b/index.html @@ -666,6 +666,36 @@ + + + +
+

Crop video

+

ffmpeg -i input_file -vf "crop=width:height" output_file

+

This command crops the input video to the dimensions defined

+
+
ffmpeg
starts the command
+
-i input_file
path, name and extension of the input file
+
-vf "width:height"
Crops the video to the given width and height (in pixels).
+ By default, the crop area is centred: that is, the position of the top left of the cropped area is set to x = (input_width - output_width) / 2, y = input_height - output_height) / 2. +
+
output_file
path, name and extension of the output file
+
+

It's also possible to specify the crop position by adding the x and y coordinates representing the top left of your cropped area to your crop filter, as such:

+

ffmpeg -i input_file -vf "crop=width:height[:x_position:y_position]" output_file

+

Examples

+

The original frame, a screenshot of the SMPTE colourbars:

+ VLC screenshot of Maggie Cheung +

Result of the command ffmpeg -i smpte_coloursbars.mov -vf "crop=500:500" output_file:

+ VLC screenshot of Maggie Cheung, cropped from original +

Result of the command ffmpeg -i smpte_coloursbars.mov -vf "crop=500:500:0:0" output_file, appending :0:0 to crop from the top left corner:

+ VLC screenshot of Maggie Cheung, cropped from original +

Result of the command ffmpeg -i smpte_coloursbars.mov -vf "crop=500:300:500:30" output_file:

+ VLC screenshot of Maggie Cheung, cropped from original + +
+ +

Change or view audio properties

@@ -1966,20 +1996,44 @@

Split audio and video tracks

-

ffmpeg -i input_file -map 0:v:0 video_output_file -map 0:a:0 audio_output_file

+

ffmpeg -i input_file -map 0:v:0 video_output_file -map 0:a:0 audio_output_file

This command splits the original input file into a video and audio stream. The -map command identifies which streams are mapped to which file. To ensure that you’re mapping the right streams to the right file, run ffprobe before writing the script to identify which streams are desired.

ffmpeg
starts the command
-i input_file
path, name and extension of the input file
-
-map 0:v:0
grabs the first video stream and maps it into:
+
-map 0:v:0
grabs the first video stream and maps it into:
video_output_file
path, name and extension of the video output file
-
-map 0:a:0
grabs the first audio stream and maps it into:
+
-map 0:a:0
grabs the first audio stream and maps it into:
audio_output_file
path, name and extension of the audio output file
+ + + +
+

Merge audio and video tracks

+

ffmpeg -i video_file -i audio_file -map 0:v -map 1:a -c copy output_file

+

This command takes a video file and an audio file as inputs, and creates an output file that combines the video stream in the first file with the audio stream in the second file.

+
+
ffmpeg
starts the command
+
-i video_file
path, name and extension of the first input file (the video file)
+
-i audio_file
path, name and extension of the second input file (the audio file)
+
-map 0:v
selects the video streams from the first input file
+
-map 1:a
selects the audio streams from the second input file
+
-c copy
copies streams without re-encoding
+
output_file
path, name and extension of the output file
+
+

Note: in the example above, the video input file is given prior to the audio input file. However, input files can be added any order, as long as they are indexed correctly when stream mapping with -map. See the entry on stream mapping.

+

Variation:

+

Include the audio tracks from both input files with the following command:

+

ffmpeg -i video_file -i audio_file -map 0:v -map 0:a -map 1:a -c copy output_file

+ +
+ +