Used Commands
You can copy and paste them into your Terminal. (A triple-click will select the full command on some operating systems.)
Find help
Find a template for the generation of TIFF exercise files that simulate a 2K scan.
ffmpeg -h encoder=tiff
Supported pixel formats: rgb24 rgb48le pal8 rgba rgba64le gray ya8 gray16le ya16le monob monow yuv420p yuv422p yuv440p yuv444p yuv410p yuv411p
ffplay -f lavfi -i testsrc
Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240
ffplay -f lavfi -i testsrc2
Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240
ffplay -f lavfi -i mandelbrot
Video: rawvideo (RGB[0] / 0x424752), rgb0, 640x480
rgb0 = packed RGB 8:8:8, 32 bpp
Generate image files
mkdir FIAF
ffmpeg -f lavfi -i "mandelbrot=size=2048x1536" -pix_fmt rgb48le -compression_algo 1 -t 10 FIAF/mandelbrot_%06d.tif
Play the generated image files
ffplay FIAF/mandelbrot_%06d.tif
Video: tiff, rgb48le, 2048x1536 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
ffplay -framerate 1 FIAF/mandelbrot_%06d.tif
Generate a sound file
The sound should simulate waves on the seashore. We use just noise but give it a little structure.
ffmpeg -f lavfi -i "anoisesrc=color=brown" -filter:a "tremolo=f=0.1:d=0.9" -c:a pcm_s24le -ar 96k -ac 2 -t 10 seashore.wav
Play the generated sound file
ffplay seashore.wav
Make an access file
We apply both a video and an audio filter. The video filter consists actually of two filters:
- scaling and
- hue manipulation.
The sound filter is an EBU R 128 normalisation.
ffmpeg -f image2 -i FIAF/mandelbrot_%06d.tif -i seashore.wav -filter:v "scale=640:480:flags=lanczos, hue=H=.5*t" -filter:a "loudnorm=I=-16:LRA=11:TP=-1.5" -c:a aac -ar 44100 -c:v libx264 -pix_fmt yuv420p -preset veryslow -crf 18 -movflags +faststart madelsea_H264.mp4
Play the generated access file
ffplay madelsea_H264.mp4
Extract metadata from the generated access file
ffprobe -show_format -show_streams -print_format json madelsea_H264.mp4
mediainfo madelsea_H264.mp4
mediainfo --Details=1 madelsea_H264.mp4
Generate a longer exercise sound file
ffmpeg -f lavfi -i "anoisesrc=color=brown" -filter:a "tremolo=f=0.1:d=0.9" -c:a pcm_s24le -ar 96k -ac 2 -t 60 seashore_good.wav
Damage the sound file by adding some random noise
ffmpeg -i seashore_good.wav -c copy -bsf:a noise=amount=-1 seashore_bad.wav
Play the damaged sound file
ffplay seashore_bad.wav
Visualise the volume
ffplay -f lavfi "amovie=seashore_good.wav, asplit[a][out1]; [a]showvolume=c=VOLUME:w=1000:h=100:ds=lin[out0]"
ffplay -f lavfi "amovie=seashore_bad.wav, asplit[a][out1]; [a]showvolume=c=VOLUME:w=1000:h=100:ds=lin[out0]"
Visualise the wave
ffplay -f lavfi "amovie=seashore_good.wav, asplit[a][out1]; [a]showwaves=mode=cline[out0]"
ffplay -f lavfi "amovie=seashore_bad.wav, asplit[a][out1]; [a]showwaves=mode=cline[out0]"
Visualise the spectrum
ffplay -f lavfi "amovie=seashore_good.wav, asplit[a][out1]; [a]showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt[out0]"
ffplay -f lavfi "amovie=seashore_bad.wav, asplit[a][out1]; [a]showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt[out0]"
Visualise the musical notes
ffplay -f lavfi "amovie=seashore_good.wav, asplit[out1][a], [a]showcqt[out0]"
ffplay -f lavfi "amovie=seashore_bad.wav, asplit[out1][a], [a]showcqt[out0]"
Check the list of the installed fonts
cd /Library/Fonts
ls
Add a watermark
ffmpeg -i madelsea_H264.mp4 -filter:v "drawtext=text='For FIAF':fontfile=/Library/Fonts/Arial.ttf:fontsize=35:fontcolor=white:alpha=0.25:x=(w-text_w)/2:y=(h-text_h)/2" madelsea_watermark_H264.mp4
Play the file
ffplay madelsea_watermark_H264.mp4
Add a timecode
ffmpeg -i madelsea_H264.mp4 -filter:v "drawtext=fontfile=/Library/Fonts/Arial.ttf:timecode='00\:00\:00\:00':rate=25:fontsize=35:text='TCR\:':fontcolor=white:x=(w-text_w)/2:y=h/1.2" madelsea_timecode_H264.mp4
Play the file
ffplay madelsea_timecode_H264.mp4
An alternate Homebrew formula
On Homebrew there are also alternate formulae with options to install FFmpeg. One is provided by our company and if your computer is online, you can see the available options by passing in the Terminal:
brew options avpres/formulae/ffmpeg
You can see the formula with:
brew cat avpres/formulae/ffmpeg
2023-04-02
|