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.
This project is very much a work in progress. 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 after specifying an [input] and possibly an [output], you can then use this command in a Terminal.
For FFmpeg basics, check out the program's official website.
For Bash and command line basics, try the Command Line Crash Course
Part 1: Create 3 second clip from an existing source file (no audio necessary)
ffmpeg -ss HH:MM:SS -i input.mov -c:v copy -c:a copy -t 3 output.mov
Part 2: Make the gif
ffmpeg -i input.mov -vf scale=500:-1 -t 10 -r 30 output.gif
ffmpeg -i [inputfile.wav] -sample_fmt s16p -ar 44100 [outputfile.mp3]
This will convert your wav files to mp3s.
for f in *.MXF; do ffmpeg -i "$f" -acodec copy -vcodec copy "${f%.MXF}.mov"; done
Re-wrap .MFX files in a specified directory to .mov files by using this code within a .sh file. The shell script (.sh file) and all MXF files must be contained in the same directory, and the script must be run from the directory itself (cd ~/Desktop/MXF_file_directory). Execute .sh file with the command sh Rewrap-MXF.sh
Modify the ffmpeg script as needed to perform different transcodes :)
ffmpeg -i [inputfile.extension] -an -f framemd5 [outputfile.framemd5]
This will create an md5 checksum per frame
ffmpeg -i input.mov -vcodec prores -profile:v 1 -acodec pcm_s16le -vf yadif output.mov
This command transcodes an input file (input.mov) into a deinterlaced Apple ProRes LT .mov file with 16-bit linear PCM encoded audio. The file is deinterlaced using the yadif (Yet Another De-Interlacing Filter) command.
ffmpeg -i [file path] -ss 00:00:20 -f image2 -vframes 1 thumb.png
This command will grab a thumbnail 20 seconds into the video.
ffmpeg -i {path/inputfile.extension} -f image2 -vf fps=fps=1/60 out%d.png
This will grab a thumbnail every minute and output sequential png files.
ffprobe -i filename.avi -show_format -show_streams -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, https://www.ffmpeg.org/ffprobe.html)
ffmpeg -f concat -i mylist.txt -c copy [output]
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!
ffmpeg documentation on concatenating files (full list of flags, commands, https://trac.ffmpeg.org/wiki/Concatenate)
ffmpeg -i [input file] -t 5 -c copy [output]
This command captures a certain portion of a video file, starting from the beginning and continuing for the amount of time (in seconds) specified in the script. This can be used to create a preview file, or to remove unwanted content from the end of the file. To be more specific, use timecode, such as 00:00:05.
ffmpeg -i [input file] -ss 5 -t 5 -c copy [output]
This command captures a certain portion of a video file, starting from a designated point in the file and taking an excerpt as long as the amount of time (in seconds) specified in the script. This can be used to create a preview or clip out a desired segment. To be more specific, use timecode, such as 00:00:05.
ffmpeg -i [input file] -ss 5 -c copy [output]
This command copies a video file starting from a specified time, removing the first few seconds from the output. This can be used to create an excerpt, or remove unwanted content from the beginning of a video file.
ffmpeg -i [input file] -map 0:0 [video output file] -map 0:1 [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 stream is 0:0, which is 0:1, etc.
ffmpeg -i [input file] -vcodec libx264 -acodec copy [output file.mp4]
This command takes an input file and transcodes it to h.264 with an .mp4 wrapper, keeping the audio the same codec as the original. The libx264 codec defaults to a “medium” preset for compression quality and a CRF of 23. CRF stands for constant rate factor and determines the quality and file size of the resulting h.264 video. A low CRF means high quality and large file size; a high CRF means the opposite.
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] -vcodec libx264 -acodec copy -preset veryslow -crf 18 [output file.mp4]
libx264 also defaults to 4:2:2 chroma subsampling. Some versions of Quicktime can't read x264 files in 4:2:2. In order to allow the video to play in all Quicktime players, you can specify 4:2:0 chroma subsampling instead:
ffmpeg -i [input file] -vcodec libx264 -pix_fmt yuv420p -acodec copy -preset veryslow -crf 18 [output file.mp4]
ffmpeg -i video.mxf -i audio.mxf -c:v libx264 -pix_fmt yuv420p output.mp4
This will transcode mxf wrapped video and audio files to an h.264 encoded .mp4 file
ffmpeg -i [inputfile] -ss 00:12.235 -i "$f" -vframes 1 [outputfile]
Create one thumbnail in JPEG format from a video file at a specific time. In this example: 0hours:0minutes:12sec.235msec
Made with ♥ at AMIA #AVhack15