ffmpeg examples
February 18, 2013
http://ffmpeg.org/
Below are a few samples that I use on a regular basis.
Sample 1. Convert an avi file to an flv file (flash). ‘-sameq’ means keep same quality as source. in this example, the video file is G.avi. ‘-i’ means the input file follows. The output file is always the last file on the line.
1 |
ffmpeg -i G.avi -sameq G.flv |
Sample 2. Cut some time out of a video cut time out of a video (what I use to make 1 second long videos, can omit the start time)
1 |
ffmpeg -sameq -ss [start_seconds] -t [duration_seconds] -i [input_file] [outputfile] |
Sample 3. the following will extract the bitmaps from the avi file and name them as images/000001.bmp and so on. the ‘%6d’ is a special character set that says make a number with a pattern of six digits. in this example a subfolder called ‘images’ has the bitmap files.
1 |
ffmpeg -i G.avi images/%6d.bmp |
Sample 4.make a movie from individual bitmap frames with high quality using the bit rate control the frames are in the subfolder ‘movie’. the ‘0%d’ is a special character set thats look for files names that start with a zero followed by a number. For example movie/0001.png movie/0002.png.The ‘-b:v 4000k’ means set the encoding bit rate to variable with a peak rate of 4 megabits/second. to make the file size smaller, drop down below 4mpbs, the lower the number the more lossy. to make the file size larger, and less lossy, increase the peak bit rate.
1 |
ffmpeg -i movie/0%d.png -b:v 4000k test.avi |
Sample 5. crop to 720×480 with upper left stating at position 67,67, force video codec to h264
1 |
ffmpeg -i movie.wmv -vcodec h264 -vf crop=720:480:67:67 movie.mp4 |
Entry filed under: Image Processing. Tags: .