Compare commits

...

17 Commits

Author SHA1 Message Date
Ashley
e7d8dd58b9 Merge pull request #448 from amiaopensource/ablwr-patch-1
add ffmpeg-artschool as sibling
2020-11-30 10:22:04 -05:00
Ashley
a25c20a855 add target blank 2020-11-30 10:18:57 -05:00
Ashley
c0d3761ce5 Merge pull request #449 from amiaopensource/ablwr-patch-2
rebrand "sister" to gender-neutral "sibling"
2020-11-30 10:15:12 -05:00
Ashley
869ffda8c4 rebrand "sister" to gender-neutral "sibling" 2020-11-30 10:11:43 -05:00
Ashley
789329b415 add ffmpeg-artschool as sibling 2020-11-30 10:10:43 -05:00
Ashley
23e0097b54 Merge pull request #446 from axfelix/gh-pages
add hardware encoding examples
2020-11-22 13:55:18 -05:00
Alex Garnett
ca86a0eca4 fix hevc profile in separate example 2020-11-22 10:50:43 -08:00
Alex Garnett
bc0edae268 add separate hevc recipe 2020-11-22 10:46:23 -08:00
Alex Garnett
87314cef76 fix preset command 2020-11-22 10:42:18 -08:00
Alex Garnett
77a7a2b3dc add hardware encoding examples 2020-11-22 10:30:42 -08:00
Ashley
f0aab69f0f Merge pull request #445 from amiaopensource/ffmprovisr_typo
fix tiny typo
2020-11-16 08:39:31 -05:00
רטו
5c0b98bded fix tiny typo 2020-11-16 12:49:55 +01:00
bturkus
2677cd74e7 update pbs tech specs link (#444) 2020-11-12 13:30:19 +01:00
Reto Kromer
46d65cf4d0 update recipe list (#443) 2020-09-28 08:07:11 +02:00
Reto Kromer
638bb951dd fix HTML (#442) 2020-07-22 07:08:34 +02:00
Andrew Weaver
87581c717c Merge pull request #441 from amiaopensource/delete_space
delete a space before `</h5>`
2020-07-20 10:29:54 -07:00
Reto Kromer
ba49741c9f delete a space before </h5> 2020-07-20 18:14:35 +02:00
2 changed files with 47 additions and 29 deletions

View File

@@ -58,12 +58,13 @@
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank"><img alt="Creative Commons License" src="img/cc.png"></a><br>
This work is licensed under a <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">Creative Commons Attribution 4.0 International License</a>.
</p>
<h3>Sister projects</h3>
<h3>Sibling projects</h3>
<p><a href="https://dd388.github.io/crals/" target="_blank">Script Ahoy</a>: Community Resource for Archivists and Librarians Scripting</p>
<p><a href="https://datapraxis.github.io/sourcecaster/" target="_blank">The Sourcecaster</a>: an app that helps you use the command line to work through common challenges that come up when working with digital primary sources.</p>
<p><a href="https://pugetsoundandvision.github.io/micropops/" target="_blank">Micropops</a>: One liners and automation tools from Moving Image Preservation of Puget Sound</p>
<p><a href="https://amiaopensource.github.io/cable-bible/" target="_blank">Cable Bible</a>: A Guide to Cables and Connectors Used for Audiovisual Tech</p>
<p><a href="https://eaasi.gitlab.io/qemu-qed/" target="_blank">QEMU QED</a>: instructions for using QEMU (Quick EMUlator), a command line application for computer emulation and virtualization</p>
<p><a href="https://amiaopensource.github.io/ffmpeg-artschool/" target="_blank">ffmpeg-artschool</a>: An AMIA workshop featuring scripts, exercises, and activities to make art using FFmpeg</p>
</div>
<div class="well">
@@ -337,6 +338,38 @@
</div>
<!-- ends Transcode to H.264 -->
<!-- Transcode to H.264 or H.265 using the GPU -->
<label class="recipe" for="transcode_gpu">Transcode to H.264/H.265 using the GPU</label>
<input type="checkbox" id="transcode_gpu">
<div class="hiding">
<h5>Transcode to H.264/H.265 using the GPU</h5>
<p><code>ffmpeg -i <em>input_file</em> -c:v h264_nvenc -preset llhq -rc:v vbr_hq -cq:v 19 -b:v 8000k -maxrate:v 12000k -profile:v high -c:a copy <em>output_file</em></code></p>
<p>This command takes an input file and transcodes it to H.264 using the encoding functionality of an Nvidia GPU (without transcoding the audio). If you're using H.264 with AAC or AC3 audio, you can output to an .mp4 file; if you're using HEVC and/or more exotic audio, you should output to .mkv. While Nvidia's fixed-function hardware can be 10x as performant as encoding on the CPU, it requires a few more parameters in order to optimize quality at lower bitrates.</p>
<dl>
<dt>ffmpeg</dt><dd>starts the command</dd>
<dt>-i <em>input_file</em></dt><dd>path, name and extension of the input file</dd>
<dt>-c:v <em>h264_nvenc</em></dt><dd>tells FFmpeg to encode the video stream as H.264 using Nvidia's encoder.</dd>
<dt>-preset <em>llhq</em></dt><dd>uses the "low latency, high quality" encoding preset, a good default when working with nvenc.</dd>
<dt>-rc:v <em>vbr_hq</em></dt><dd>means "variable bitrate, high quality," allowing you to set a minimum and maximum bitrate for the encode.</dd>
<dt>-cq:v <em>19</em></dt><dd>is the same as the CRF quality level specified using x264 or other CPU-based encoders, where 0 is lossless, 51 is the worst possible quality, and values from 18-23 are typical.</dd>
<dt>-b:v <em>8000k -maxrate:v 12000k</em></dt><dd>corresponds to a minimum bitrate of 8 megabits (8000k) per second, and a maximum of 12 megabits per second. nvenc is not as good at estimating bitrates as CPU-based encoders, and without this data, will occasionally choose a visibly lower bitrate. The 8-12 mbit range is generally a good one for high-quality 1080p h264.</dd>
<dt>-profile:v <em>high</em></dt><dd>uses the "high quality" profile of h264, something that's been baked in to the spec for a long time so that older players can declare compatibility; almost all h264 video now uses high.</dd>
<dt>-c:a <em>copy</em></dt><dd>will skip reencoding the audio stream, and copy the audio from the source file.</dd>
<dt><em>output_file</em></dt><dd>path, name and extension of the output file</dd>
</dl>
<p>In order to encode to HEVC instead, and optionally transcode the audio, you can try changing the command like this:</p>
<p><code>ffmpeg -i <em>input_file</em> -c:v hevc_nvenc -preset llhq -rc:v vbr_hq -cq:v 19 -b:v 5000k -maxrate:v 8000k -profile:v main10 -c:a aac <em>output_file</em></code></p>
<dl>
<dt>-c:v <em>hevc_nvenc</em></dt><dd>encodes to HEVC (also called H.265), a more efficient codec supported on GPUs from approximately 2015 and newer.</dd>
<dt>-b:v <em>5000k -maxrate:v 8000k</em></dt><dd>specifies a slightly lower bitrate than when using h264, per HEVC's greater efficiency.</dd>
<dt>-profile:v <em>main10</em></dt><dd>declares the "main10" profile for working with HEVC; one of the primary advantages of this codec is better support for 10-bit video, enabling consumer HDR.</dd>
<dt>-c:a <em>aac</em></dt><dd>reencodes the audio to AAC with default parameters, a very common and widely supported format for access copies.</dd>
</dl>
<p>Much of the information in this entry was taken from <a href="https://superuser.com/a/1236387" target="_blank">this superuser.com post</a> provided by an Nvidia developer, one of the best sources of information on the ffmpeg Nvidia encoders.</p>
<p class="link"></p>
</div>
<!-- ends Transcode to H.264 or H.265 using the GPU -->
<!-- H.264 from DCP -->
<label class="recipe" for="dcp_to_h264">Transcode from DCP to an H.264 access file</label>
<input type="checkbox" id="dcp_to_h264">
@@ -628,10 +661,10 @@
<dt>-c:a copy</dt><dd>re-encodes using the same audio codec<br>
For silent videos you can replace <code>-c:a copy</code> with <code>-an</code>.</dd>
<dt><em>output_file</em></dt><dd>path, name and extension of the output file</dd>
<p>If your source is interlaced, you will want to deinterlace prior to scaling. In that case, your command would look like this:</p>
<p><code>ffmpeg -i <em>input_file</em> -c:v libx264 -filter:v "yadif, colormatrix=bt601:bt709, scale=1440:1080:flags=lanczos, pad=1920:1080:240:0" -c:a copy <em>output_file</em></code></p>
<p>See the <a href="#ntsc_to_h264">Interlaced NTSC to MP4 recipe</a> for a fuller explanation of the deinterlacing step.</p>
</dl>
<p>If your source is interlaced, you will want to deinterlace prior to scaling. In that case, your command would look like this:</p>
<p><code>ffmpeg -i <em>input_file</em> -c:v libx264 -filter:v "yadif, colormatrix=bt601:bt709, scale=1440:1080:flags=lanczos, pad=1920:1080:240:0" -c:a copy <em>output_file</em></code></p>
<p>See the <a href="#ntsc_to_h264">Interlaced NTSC to MP4 recipe</a> for a fuller explanation of the deinterlacing step.</p>
<p class="link"></p>
</div>
<!-- ends SD to HD -->
@@ -723,7 +756,7 @@
<li>In the sound filter <code>atempo</code> the numerator <code>output_fps</code> sets the output speed and the denominator <code>input_fps</code> sets the input speed; both values are given in frames per second.</li>
</ul>
The different filters in a complex filter can be divided either by comma or semicolon. The quotation marks allow to insert a space between the filters for readability.</dd>
<dt>-map "[v]"</dt><dd>maps the video stream and:</dd>
<dt>-map "[v]"</dt><dd>maps the video stream and</dd>
<dt>-map "[a]"</dt><dd>maps the audio stream together into:</dd>
<dt><em>output_file</em></dt><dd>path, name and extension of the output file</dd>
</dl>
@@ -940,7 +973,7 @@
<p><code>ffmpeg -i <em>input_file</em> -af loudnorm=print_format=json -f null -</code></p>
<p>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.</p>
<p>These instructions use the loudnorm defaults, which align well with PBS recommendations for target loudness. More information can be found at the <a href="https://ffmpeg.org/ffmpeg-filters.html#loudnorm" target="_blank">loudnorm documentation</a>.</p>
<p>Information about PBS loudness standards can be found in the <a href="https://www-tc.pbs.org/capt/Producing/TOS-2012-Pt2-Distribution.pdf" target="_blank">PBS Technical Operating Specifications</a> document. Information about EBU loudness standards can be found in the <a href="https://tech.ebu.ch/docs/r/r128-2014.pdf" target="_blank">EBU R 128</a> recommendation document.</p>
<p>Information about PBS loudness standards can be found in the <a href="http://bento.cdn.pbs.org/hostedbento-prod/filer_public/PBS_About/Producing/Red%20Book/TOS%20Pt%201%20Submission%202016.pdf" target="_blank">PBS Technical Operating Specifications</a> document. Information about EBU loudness standards can be found in the <a href="https://tech.ebu.ch/docs/r/r128-2014.pdf" target="_blank">EBU R 128</a> recommendation document.</p>
<dl>
<dt>ffmpeg</dt><dd>starts the command</dd>
<dt><em>input_file</em></dt><dd>path, name and extension of the input file</dd>
@@ -1506,7 +1539,7 @@
<label class="recipe" for="embed_subtitles">Embed subtitles</label>
<input type="checkbox" id="embed_subtitles">
<div class="hiding">
<h5>Embed a subtitle file into a movie file </h5>
<h5>Embed a subtitle file into a movie file</h5>
<p><code>ffmpeg -i <em>input_file</em> -i <em>subtitles_file</em> -c copy -c:s mov_text <em>output_file</em></code></p>
<dl>
<dt>ffmpeg</dt><dd>starts the command</dd>

View File

@@ -16,6 +16,10 @@ ffmpeg -i input_file -map 0 -dn -c:v ffv1 -level 3 -g 1 -slicecrc 1 -slices 16 -
ffmpeg -i concat:input_file_1\|input_file_2\|input_file_3 -c:v libx264 -c:a aac output_file.mp4
# Transcode to an H.265/HEVC MP4
ffmpeg -i input_file -c:v libx265 -pix_fmt yuv420p -c:a copy output_file
# Transcode to H.264 using the GPU
ffmpeg -i input_file -c:v h264_nvenc -preset llhq -rc:v vbr_hq -cq:v 19 -b:v 8000k -maxrate:v 12000k -profile:v high -c:a copy output_file
# Transcode to H.265 using the GPU
ffmpeg -i input_file -c:v hevc_nvenc -preset llhq -rc:v vbr_hq -cq:v 19 -b:v 5000k -maxrate:v 8000k -profile:v main10 -c:a copy output_file
# Transcode to an Ogg Theora
ffmpeg -i input_file -acodec libvorbis -b:v 690k output_file
# Convert WAV to MP3
@@ -108,7 +112,7 @@ ffmpeg -i input_file -ss 00:00:20 -vframes 1 thumb.png
ffmpeg -i input_file -vf fps=1/60 out%d.png
# Create GIF from still images
ffmpeg -f image2 -framerate 9 -pattern_type glob -i "input_image_*.jpg" -vf scale=250x250 output_file.gif
# Create GIF from a video
# Create GIF from a video
ffmpeg -ss HH:MM:SS -i input_file -filter_complex "fps=10,scale=500:-1:flags=lanczos,palettegen" -t 3 palette.png
ffmpeg -ss HH:MM:SS -i input_file -i palette.png -filter_complex "[0:v]fps=10, scale=500:-1:flags=lanczos[v], [v][1:v]paletteuse" -t 3 -loop 6 output_file
# Transcode an image sequence into uncompressed 10-bit video
@@ -161,7 +165,7 @@ ffmpeg -f lavfi -i smptebars=size=720x576:rate=25 -c:v prores -t 10 output_file
ffmpeg -f lavfi -i testsrc=size=720x576:rate=25 -c:v v210 -t 10 output_file
# Play HD SMPTE bars
ffplay -f lavfi -i smptehdbars=size=1920x1080
# Play VGA SMPTE bars
# Play VGA SMPTE bars
ffplay -f lavfi -i smptebars=size=640x480
# Generate a sine wave test audio file
ffmpeg -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=5" -c:a pcm_s16le output_file.wav
@@ -181,7 +185,7 @@ ffmpeg -i input_one -i input_two -filter_complex signature=detectmode=full:nb_in
ffmpeg -i input -vf signature=format=xml:filename="output.xml" -an -f null -
# Play an image sequence
ffplay -framerate 5 input_file_%06d.ext
# Split audio and video tracks
# Split audio and video tracks
ffmpeg -i input_file -map 0:v:0 video_output_file -map 0:a:0 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
@@ -195,22 +199,3 @@ ffmpeg -i input_file -filter:v drawbox=w=iw:h=7:y=ih-h:t=max output_file
ffmpeg -re -i ${INPUTFILE} -map 0 -flags +global_header -vf scale="1280:-1,format=yuv420p" -pix_fmt yuv420p -level 3.1 -vsync passthrough -crf 26 -g 50 -bufsize 3500k -maxrate 1800k -c:v libx264 -c:a aac -b:a 128000 -r:a 44100 -ac 2 -t ${STREAMDURATION} -f tee "[movflags=+faststart]${TARGETFILE}|[f=flv]${STREAMTARGET}"
# View FFmpeg subprogram information
ffmpeg -h type=name
# Rip a CD with CD Paranoia
cdparanoia -L -B -O [Drive Offset] [Starting Track Number]-[Ending Track Number] output_file.wav
# Rip a CD with Cdda2wav
cdda2wav -L0 -t all -cuefile -paranoia paraopts=retries=200,readahead=600,minoverlap=sectors-per-request-1 -verbose-level all output.wav
# Compare two images
compare -metric ae image1.ext image2.ext null:
# Create thumbnails of images
mogrify -resize 80x80 -format jpg -quality 75 -path thumbs *.jpg
# Creates grid of images from text file
montage @list.txt -tile 6x12 -geometry +0+0 output_grid.jpg
# Get file signature data
convert -verbose input_file.ext | grep -i signature
# Removes exif metadata
mogrify -path ./stripped/ -strip *.jpg
# Resizes image to specific pixel width
convert input_file.ext -resize 750 output_file.ext
# Transcoding to/from FLAC
flac --best --keep-foreign-metadata --preserve-modtime --verify input.wav
flac --decode --keep-foreign-metadata --preserve-modtime --verify input.flac