Export Video Frame to PNG Image File
Scritto dail .
Ever wanted to export a frame of video to an image file (such as a PNG file)? Well, here's how to do it with gstreamer. These examples use the gstreamer command line syntax (gst-launch):
Export a DV file frame to a PNG file:
gst-launch filesrc location=/home/jonathan/capture003.dv ! dvdemux name=demux ! dvdec ! ffmpegcolorspace ! pngenc ! filesink location=foo.png
Export an MPEG file frame to a PNG file:
gst-launch filesrc location=/home/jonathan/Cow.mpg ! mpegdemux ! mpeg2dec ! ffmpegcolorspace ! pngenc ! filesink location=foo.png
My next task to figure out how to create this same pipeline via Python, so I can do this programmaticly. I'll post a Python example once I figure it out.
UPDATE: I've finally figured out how to accomplish this in Python with an even more flexible pipeline than the examples above... Click Here to read how.