11 December, 2010

How to extract segment of video using FFMPEG

Once i had a situation where i had to extract a part (segment) of a video lets say from 3rd second to 8thd second. So after searching through FFMPEG documentation
i came to know how this could be done.
Following code snippet can be used to extract a segment of video.

$inputFile = "melt.mpg";
$outputFile = "melted.flv";
//-ss is the start time in HH:mm:ss
//-t is the end time in HH:mm:ss
system("path-to-ffmpeg/ffmpeg -i $inputFile -ss 00:00:03 -t 00:00:08 $outputFile");

And that's it.

1 comment:

Anonymous said...

Worked like a charm - Thanks!