

we wish to encode an avi file into an mp4 file. Lets take the same example as above, i.e. * -ss => start time in seconds or HH:MM:SS If you wish to specify a starting point for the preview, you can pass a -ss 10 option which in this case will generate a 30-second clip beginning from the 10th second.įfmpeg -i inputFile.avi -c copy -t 30 outputFile.mp4įfmpeg -i inputFile.avi -c copy -ss 10 -t 30 outputFile.mp4 To see a small preview of how the output will look, you could pass a -t 30 option, which means that only the first 30 seconds of the input video will be processed.

The filesize of the output video remains the same as that of the input.

(which is why this type of encoding will be very fast!) The only thing that changes is the container. Here, we passed the -c copy option which causes the original audio + video streams (with their codecs) to simply be copied. Lets say you wish to encode an AVI into a MP4 file.įfmpeg -i inputFile.avi -c copy outputFile.mp4 Encoding a Video from 1 format to another: Copy Encoding/ Stream copy – Now that you have an idea of the basics of a Video file, lets go ahead and learn how we could encode video into a different format.ġ. Examples of some popular containers are OGG (.ogg), AVI (.avi), MPEG (.mpeg), Matroska (.mkv). The container is represented by a file extension. These components would be the video itself, the audio track(or even multiple audio tracks), the subtitles if any, meta-data and so on.
