FFMPEG : Quick & Useful
We will write down here some quick and useful tips that people working with video might frequently use…
#1-Extracting video frames
ffmpeg -y -i M2U00008.MPG -vframes 10 -ss 00:00:10 -vcodec png -f image2 -s 320×240 x%03d.png
The “-vframes 10” tells ffmpeg to extract the 10 first video frames of the input file. “-ss 00:00:10” tells the program at which time to start the extraction and “-f image2” is necessary to extract single frame files. The “%03d” in the output filename is like the C syntax in printf (creates 3-digit integer numbers to distinguish the different frames filenames). The “-s 320×240” is used to scale the frames in 320×240. If omitted, the original video dimensions will be used.
#2-Converting a sequence of Y video frames into a gray-scale avi-format video
Here we will need to combine imagemagick with ffmpeg. mogrify is a tool from the imagemagick suite.
mogrify -depth 8 -size 176×144 -format png *.Y
The line above will batch create copies of our 176×144, 8bpp .Y frames into .png files.
Then with…
ffmpeg -f image2 -i CLAIRE%d.png -r 12 -s 176×144 claire_video.avi
all the .png files will be combined into a single .avi file. Now you can see your video file with any common video player. Parameters -s and -f have been explained in tip #1. The -r parameter defines the frame rate. If wrongly provided, the video might become too slow or too fast.
Send us your useful tip to update this page with useful information (email vfotop1@eap.gr).
Leave a reply →