diff --git a/check_framemd5.sh b/check_framemd5.sh index 9476fc7..d5519a4 100644 --- a/check_framemd5.sh +++ b/check_framemd5.sh @@ -1,19 +1,19 @@ #!/usr/bin/env bash SCRIPT=$(basename "${0}") - VERSION='2016-10-09' + VERSION='2016-12-31' AUTHOR='ffmprovisr' RED='\033[1;31m' BLUE='\033[1;34m' NC='\033[0m' -if [[ $OSTYPE = "cygwin" ]] || [ ! $(which diff) ]; then - echo -e "${RED}ERROR:${NC} 'diff' is not installed by default. Please install 'diffutils' from Cygwin." +if [[ ${OSTYPE} = "cygwin" ]] || [ ! $(which diff) ]; then + echo -e "${RED}Error: 'diff' is not installed by default. Please install 'diffutils' from Cygwin.${NC}" exit 1 fi _output_prompt(){ cat < -m ] +Usage: ${SCRIPT} [-h] | [ -i -m ] EOF exit 1 } @@ -41,36 +41,34 @@ unset input_file unset input_hash while getopts ":hi:m:" opt; do - case "${opt}" in - h) _output_help ;; - i) input_file=$OPTARG ;; - m) input_hash=$OPTARG ;; - :) echo -e "${RED}Error:${NC} option -${OPTARG} requires an argument" ; _output_prompt ;; - *) echo -e "${RED}Error:${NC }bad option -${OPTARG}" ; _output_prompt ;; - esac + case "${opt}" in + h) _output_help ;; + i) input_file=$OPTARG ;; + m) input_hash=$OPTARG ;; + :) echo -e "${RED}Error: option -${OPTARG} requires an argument${NC}" ; _output_prompt ;; + *) echo -e "${RED}Error: bad option -${OPTARG}${NC}" ; _output_prompt ;; + esac done [[ -z "${#}" || ! ${input_file} || ! ${input_hash} ]] && _output_prompt echo -e "${BLUE}Please wait...${NC}" unset md5_tmp if [[ $OSTYPE = "cygwin" ]]; then - md5_tmp=""${USERPROFILE}/$(basename ${input_hash}).tmp"" + md5_tmp=""${USERPROFILE}/$(basename ${input_hash}).tmp"" else - md5_tmp="${HOME}/$(basename ${input_hash}).tmp" + md5_tmp="${HOME}/$(basename ${input_hash}).tmp" fi $(ffmpeg -i ${input_file} -loglevel 0 -f framemd5 -an ${md5_tmp}) -[[ ! -f ${md5_tmp} ]] && { echo -e "${RED}Error:${NC} '${input_file}' is not a valid audio-visual file."; _output_prompt; } +[[ ! -f ${md5_tmp} ]] && { echo -e "${RED}Error: '${input_file}' is not a valid audio-visual file.${NC}" ; _output_prompt ; } unset old_file unset tmp_file old_file=$(grep -v '^#' ${input_hash}) tmp_file=$(grep -v '^#' ${md5_tmp}) if [[ "${old_file}" = "${tmp_file}" ]]; then - echo -e "${BLUE}OK${NC} '$(basename ${input_file})' matches '$(basename ${input_hash})'." - rm "${md5_tmp}" - exit 0 + echo -e "${BLUE}'$(basename ${input_file})' matches '$(basename ${input_hash})'${NC}" + rm "${md5_tmp}" else - echo -e "${RED}ERROR:${NC} The following differences were detected between '$(basename ${input_file})' and '$(basename ${input_hash})':" - diff "${input_hash}" "${md5_tmp}" - rm "${md5_tmp}" - exit 1 + echo -e "${RED}The following differences were detected between '$(basename ${input_file})' and '$(basename ${input_hash})':${NC}" + diff "${input_hash}" "${md5_tmp}" + rm "${md5_tmp}" fi diff --git a/css/css.css b/css/css.css index 01383eb..04087c8 100644 --- a/css/css.css +++ b/css/css.css @@ -2,6 +2,10 @@ h1,h2,h3,h4,h5,h6 { font-family: 'Montserrat', sans-serif; } +code { + word-break: break-all; +} + dd { padding-left:24px; } @@ -10,6 +14,16 @@ dt { font-family: Menlo,Monaco,Consolas,"Courier New",monospace; } +img { + display: block; + margin-left: auto; + margin-right: auto; +} + +.sample-image { + margin-bottom: 18px; +} + h1 { letter-spacing:8px; font-size:86px; diff --git a/img/brng.gif b/img/brng.gif new file mode 100644 index 0000000..a78d36a Binary files /dev/null and b/img/brng.gif differ diff --git a/img/showspectrum.gif b/img/showspectrum.gif new file mode 100644 index 0000000..c618cfd Binary files /dev/null and b/img/showspectrum.gif differ diff --git a/index.html b/index.html index 209fe97..8b93188 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,10 @@

FFmpeg is a powerful tool for manipulating audiovisual files. Unfortunately, it also has a steep learning curve, especially for users unfamiliar with a command line interface. This app helps users through the command generation process so that more people can reap the benefits of FFmpeg.

Each button displays helpful information about how to perform a wide variety of tasks using FFmpeg. To use this site, click on the task you would like to perform. A new window will open up with a sample command and a description of how that command works. You can copy this command and understand how the command works with a breakdown of each of the flags.

For FFmpeg basics, check out the program’s official website.

-

For Bash and command line basics, try the Command Line Crash Course.

+

For Bash and command line basics, try the Command Line Crash Course. For a little more context presented in an ffmprovisr style, try explainshell.com!

+
Sister projects
+

Script Ahoy: Community Resource for Archivists and Librarians Scripting

+

The Sourcecaster: an app that helps you use the command line to work through common challenges that come up when working with digital primary sources.

@@ -46,7 +49,7 @@
@@ -142,7 +150,7 @@
-i input_audio_file
path and name of the audio input file. This extension must be .mxf
-c:v libx264
transcodes video to H.264
-pix_fmt yuv420p
sets pixel format to yuv420p for greater compatibility with media players
-
-c:a aac
re-encodes using the AAC audio codec
+
-c:a aac
re-encodes using the AAC audio codec
Note that sadly MP4 cannot contain sound encoded by a PCM (Pulse-Code Modulation) audio codec
output_file.mp4
path, name and .mp4 extension of the output file
@@ -193,8 +201,8 @@
ffmpeg
starts the command
-i input_file
path, name and extension of the input file
-
-filter:v "pad=ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
video padding
This resolution independent formula is actually padding any aspect ratio into 16:9 by pillarboxing, because the video filter uses relative values for input width (iw), input height (ih), output width (ow) and output height (oh).
-
-c:a copy
re-encodes using the same audio codec
+
-filter:v "pad=ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
video padding
This resolution independent formula is actually padding any aspect ratio into 16:9 by pillarboxing, because the video filter uses relative values for input width (iw), input height (ih), output width (ow) and output height (oh).
+
-c:a copy
re-encodes using the same audio codec
For silent videos you can replace -c:a copy by -an.
output_file
path, name and extension of the output file
@@ -217,13 +225,13 @@
ffmpeg
starts the command
-i input_file
path, name and extension of the input file
-
-filter:v "colormatrix=bt601:bt709, scale=1440:1080:flags=lanczos, pad=1920:1080:240:0"
set colour matrix, video scaling and padding
Three filters are applied: +
-filter:v "colormatrix=bt601:bt709, scale=1440:1080:flags=lanczos, pad=1920:1080:240:0"
set colour matrix, video scaling and padding
Three filters are applied:
  1. The luma coefficients are modified from SD video (according to Rec. 601) to HD video (according to Rec. 709) by a colour matrix. Note that today Rec. 709 is often used also for SD and therefore you may cancel this parameter.
  2. The scaling filter (scale=1440:1080) works for both upscaling and downscaling. We use the Lanczos scaling algorithm (flags=lanczos), which is slower but gives better results than the default bilinear algorithm.
  3. The padding filter (pad=1920:1080:240:0) completes the transformation from SD to HD.
-
-c:a copy
re-encodes using the same audio codec
+
-c:a copy
re-encodes using the same audio codec
For silent videos you can replace -c:a copy with -an.
output_file
path, name and extension of the output file
@@ -246,8 +254,8 @@
ffmpeg
starts the command
-i input_file
path, name and extension of the input file
-
-filter:v "pad=iw:iw*3/4:(ow-iw)/2:(oh-ih)/2"
video padding
This resolution independent formula is actually padding any aspect ratio into 4:3 by letterboxing, because the video filter uses relative values for input width (iw), input height (ih), output width (ow) and output height (oh).
-
-c:a copy
re-encodes using the same audio codec
+
-filter:v "pad=iw:iw*3/4:(ow-iw)/2:(oh-ih)/2"
video padding
This resolution independent formula is actually padding any aspect ratio into 4:3 by letterboxing, because the video filter uses relative values for input width (iw), input height (ih), output width (ow) and output height (oh).
+
-c:a copy
re-encodes using the same audio codec
For silent videos you can replace -c:a copy by -an.
output_file
path, name and extension of the output file
@@ -323,13 +331,13 @@

This will convert your Matroska (MKV) files to MP4 files.

ffmpeg
starts the command
-
-i input_file
path and name of the input file
+
-i input_file
path and name of the input file
The extension for the Matroska container is .mkv.
-c:v copy
re-encodes using the same video codec
-
-c:a aac
re-encodes using the AAC audio codec
- Note that sadly MP4 cannot contain sound encoded by a PCM (Pulse-Code Modulation) audio codec.
+
-c:a aac
re-encodes using the AAC audio codec
+ Note that sadly MP4 cannot contain sound encoded by a PCM (Pulse-Code Modulation) audio codec.
For silent videos you can replace -c:a aac by -an.
-
output_file
path and name of the output file
+
output_file
path and name of the output file
The extension for the MP4 container is .mp4.
@@ -353,7 +361,7 @@
-f image2
forces input or output file format. image2 specifies the image file demuxer.
-framerate 9
sets framerate to 9 frames per second
-pattern_type glob
tells ffmpeg that the following mapping should "interpret like a glob" (a "global command" function that relies on the * as a wildcard and finds everything that matches)
-
-i "input_image_*.jpg"
maps all files in the directory that start with input_image_, for example input_image_001.jpg, input_image_002.jpg, input_image_003.jpg... etc.
+
-i "input_image_*.jpg"
maps all files in the directory that start with input_image_, for example input_image_001.jpg, input_image_002.jpg, input_image_003.jpg... etc.
(The quotation marks are necessary for the above "glob" pattern!)
-vf scale=250x250
filter the video to scale it to 250x250; -vf is an alias for -filter:v
output_file.gif
path and name of the output file
@@ -377,8 +385,8 @@

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.

ffmpeg
starts the command
-
-i concat:input files
lists the input VOB files and directs ffmpeg to concatenate them. Each input file should be separated by a backslash and a pipe, like so:
- -i concat:VTS_01_1.VOB\|VTS_01_2.VOB\|VTS_01_3.VOB
+
-i concat:input files
lists the input VOB files and directs ffmpeg to concatenate them. Each input file should be separated by a backslash and a pipe, like so:
+ -i concat:VTS_01_1.VOB\|VTS_01_2.VOB\|VTS_01_3.VOB
The backslash is simply an escape character for the pipe (|).
-c:v libx264
sets the video codec as H.264
-c:a copy
audio remains as-is (no re-encode)
@@ -404,6 +412,160 @@ + +
+

Filters

+ + + + + + + + + + + + + + + + + + + + + + + + + +

Make derivative variations

@@ -474,7 +636,7 @@
ffmpeg
starts the command
-i input_file
path, name and extension of the input file
-ss 00:00:20
seeks video file to 20 seconds into the video
-
-vf fps=1/60
-vf is an alias for -filter:v, which creates a filtergraph to use for the streams. The rest of the command identifies filtering by frames per second, and sets the frames per second at 1/60 (which is one per minute). Omitting this will output all frames from the video
+
-vf fps=1/60
Creates a filtergraph to use for the streams. The rest of the command identifies filtering by frames per second, and sets the frames per second at 1/60 (which is one per minute). Omitting this will output all frames from the video.
output file
path, name and extension of the output file. In the example out%d.png where %d is a regular expression that adds a number (d is for digit) and increments with each frame (out1.png, out2.png, out3.png…). You may also chose a regular expression like out%04d.png which gives 4 digits with leading 0 (out0001.png, out0002.png, out0003.png, …).
@@ -484,29 +646,6 @@ - - - - - + + + + +

Preservation

@@ -676,19 +846,19 @@

“Rewrap-MXF.sh” contains the following text:

for file in *.MXF; do ffmpeg -i "$file" -map 0 -c copy "${file%.MXF}.mov"; done

-
for file in *.MXF
starts the loop, and states what the input files will be. Here, the ffmpeg command within the loop will be applied to all files with an extension of .MXF.
+
for file in *.MXF
starts the loop, and states what the input files will be. Here, the ffmpeg command within the loop will be applied to all files with an extension of .MXF.
The word ‘file’ is an arbitrary variable which will represent each .MXF file in turn as it is looped over.
-
do ffmpeg -i "$file"
carry out the following ffmpeg command for each input file.
+
do ffmpeg -i "$file"
carry out the following ffmpeg command for each input file.
Per Bash syntax, within the command the variable is referred to by “$file”. The dollar sign is used to reference the variable ‘file’, and the enclosing quotation marks prevents reinterpretation of any special characters that may occur within the filename, ensuring that the original filename is retained.
-map 0
retain all streams
-c copy
enable stream copy (no re-encode)
"${file%.MXF}.mov";
retaining the original file name, set the output file wrapper as .mov
done
complete; all items have been processed.
-

Note: the shell script (.sh file) and all .MXF files to be processed must be contained within the same directory, and the script must be run from that directory.
+

Note: the shell script (.sh file) and all .MXF files to be processed must be contained within the same directory, and the script must be run from that directory.
Execute the .sh file with the command sh Rewrap-MXF.sh.

Modify the script as needed to perform different transcodes, or to use with ffprobe. :)

-

The basic pattern will look similar to this:
+

The basic pattern will look similar to this:
for item in *.ext; do ffmpeg -i $item (ffmpeg options here) "${item%.ext}_suffix.ext"

e.g., if an input file is bestmovie002.avi, its output will be bestmovie002_suffix.avi.

@@ -963,14 +1133,14 @@ foreach ($file in $inputfiles) {
ffmpeg
starts the command
-f concat
forces ffmpeg to concatenate the files and to keep the same file format
-
-i mylist.txt
path, name and extension of the input file. Per the ffmpeg documentation, it is preferable to specify relative rather than absolute file paths, as allowing absolute file paths may pose a security risk.
+
-i mylist.txt
path, name and extension of the input file. Per the ffmpeg documentation, it is preferable to specify relative rather than absolute file paths, as allowing absolute file paths may pose a security risk.
This text file contains the list of files to be concatenated and should be formatted as follows:
file './first_file.ext'
 file './second_file.ext'
 . . .
 file './last_file.ext'
-In the above, file is simply the word "file".
-Note: If specifying absolute file paths in the .txt file, add -safe 0 before the input file.
+In the above, file is simply the word "file". Straight apostrophes ('like this') rather than curved quotation marks (‘like this’) must be used to enclose the file paths.
+Note: If specifying absolute file paths in the .txt file, add -safe 0 before the input file.
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
@@ -994,10 +1164,10 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_fileffplay -framerate 5 input_file_%06d.ext

ffplay
starts the command
-
-framerate 5
plays image sequence at rate of 5 images per second
+
-framerate 5
plays image sequence at rate of 5 images per second
Note: this low framerate will produce a slideshow effect.
-
-i input_file
path, name and extension of the input file
- This must match the naming convention used! The regex %06d matches six-digit-long numbers, possibly with leading zeroes. This allows the full sequence to be read in ascending order, one image after the other.
+
-i input_file
path, name and extension of the input file
+ This must match the naming convention used! The regex %06d matches six-digit-long numbers, possibly with leading zeroes. This allows the full sequence to be read in ascending order, one image after the other.
The extension for TIFF files is .tif or maybe .tiff; the extension for DPX files is .dpx (or even .cin for old files). Screenshots are often in .png format.

Notes:

@@ -1094,8 +1264,8 @@ 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
-
-filter:v "hflip,vflip"
flips the image horizontally and vertically
By using only one of the parameters hflip or vflip for filtering the image is flipped on that axis only. The quote marks are not mandatory.
-
-c:a copy
re-encodes using the same audio codec
+
-filter:v "hflip,vflip"
flips the image horizontally and vertically
By using only one of the parameters hflip or vflip for filtering the image is flipped on that axis only. The quote marks are not mandatory.
+
-c:a copy
re-encodes using the same audio codec
For silent videos you can replace -c:a copy by -an.
output_file
path, name and extension of the output file
@@ -1232,7 +1402,7 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_fileffmpeg
starts the command
-f image2
forces the image file de-muxer for single image files
-framerate 24
Sets the input framerate to 24 fps. The image2 demuxer defaults to 25 fps.
-
-i input_file
path, name and extension of the input file
+
-i input_file
path, name and extension of the input file
This must match the naming convention actually used! The regex %06d matches six digits long numbers, possibly with leading zeroes. This allows to read in ascending order, one image after the other, the full sequence inside one folder. For image sequences starting with 086400 (i.e. captured with a timecode starting at 01:00:00:00 and at 24 fps), add the flag -start_number 086400 before -i input_file_%06d.ext. The extension for TIFF files is .tif or maybe .tiff; the extension for DPX files is .dpx (or eventually .cin for old files).
-c:v v210
encodes an uncompressed 10-bit video stream
-an copy
no audio
@@ -1283,7 +1453,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
-
-filter:v setfield=tff
Sets the field order to top field first. Use setfield=bff for bottom field first.
+
-filter:v setfield=tff
Sets the field order to top field first. Use setfield=bff for bottom field first.
-c:v prores
Tells ffmpeg to transcode the video stream into Apple ProRes 422. Experiment with using other codecs.
output_file
path, name and extension of the output file
@@ -1347,13 +1517,13 @@ e.g.: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_file-h
Call the help option
type=name
Tells ffmpeg which kind of option you want, for example: -
    -
  • encoder=libx264
  • -
  • decoder=mp3
  • -
  • muxer=matroska
  • -
  • demuxer=mov
  • -
  • filter=crop
  • -
+
    +
  • encoder=libx264
  • +
  • decoder=mp3
  • +
  • muxer=matroska
  • +
  • demuxer=mov
  • +
  • filter=crop
  • +
diff --git a/readme.md b/readme.md index 26a0d1d..5e2b963 100644 --- a/readme.md +++ b/readme.md @@ -31,38 +31,48 @@ You can read our contributor code of conduct [here](https://github.com/amiaopens ## Contributors * Gathered using [octohatrack](https://github.com/LABHR/octohatrack) -GitHub Contributors: -* ablwr (Ashley) -* edsu (Ed Summers) -* jfarbowitz (Jonathan Farbowitz) -* kfrn (Katherine Frances Nagels) -* kgrons (Kathryn Gronsbell) -* kieranjol (Kieran O'Leary) -* llogan (Lou) -* retokromer (Reto Kromer) -* rfraimow +GitHub Contributors: +ablwr (Ashley) +dericed (Dave Rice) +edsu (Ed Summers) +jfarbowitz (Jonathan Farbowitz) +kfrn (Katherine Frances Nagels) +kgrons (Kathryn Gronsbell) +kieranjol (Kieran O'Leary) +llogan (Lou) +privatezero (Andrew Weaver) +retokromer (Reto Kromer) +rfraimow -All Contributors: -* ablwr (Ashley) -* brainwane (Sumana Harihareswara) -* dericed (Dave Rice) -* edsu (Ed Summers) -* jamessam (Jim) -* jfarbowitz (Jonathan Farbowitz) -* jronallo (Jason Ronallo) -* kfrn (Katherine Frances Nagels) -* kgrons (Kathryn Gronsbell) -* kieranjol (Kieran O'Leary) -* llogan (Lou) -* mulvya -* retokromer (Reto Kromer) -* rfraimow -* todrobbins (Tod Robbins) +All Contributors: +ablwr (Ashley) +audiovisualopen +brainwane (Sumana Harihareswara) +dericed (Dave Rice) +edsu (Ed Summers) +Fizz24 +jamessam (Jim) +jfarbowitz (Jonathan Farbowitz) +jronallo (Jason Ronallo) +kfrn (Katherine Frances Nagels) +kgrons (Kathryn Gronsbell) +kieranjol (Kieran O'Leary) +llogan (Lou) +mulvya +privatezero (Andrew Weaver) +retokromer (Reto Kromer) +rfraimow +todrobbins (Tod Robbins) -Repo: amiaopensource/ffmprovisr -* GitHub Contributors: 9 -* All Contributors: 15 +Repo: amiaopensource/ffmprovisr +GitHub Contributors: 11 +All Contributors: 18 ## AVHack Team: [Ashley Blewer](https://github.com/ablwr), Eddy Colloton, Rebecca Dillmeier, [Jonathan Farbowitz](https://github.com/jfarbowitz), Rebecca Fraimow, Samuel Gutterman, Kelly Haydon, [Reto Kromer](https://github.com/retokromer), Nicole Martin, [Katherine Frances Nagels](https://github.com/kfrn), [Kieran O'Leary](https://github.com/kieranjol), Catriona Schlosser, Ben Turkus + +## Sister projects + +[Script Ahoy](http://dd388.github.io/crals/): Community Resource for Archivists and Librarians Scripting +[sourcecaster](https://datapraxis.github.io/sourcecaster/): helps you use the command line to work through common challenges that come up when working with digital primary sources.