We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everyone,
I'd like to run some image-based calculations (JPEG compression ratio, for instance, to estimate visual complexity) for every single image of a movie. The movie is quite large, about 2 Gig. All the methods I've found with the GSVideo library won't work, as a video can either be streamed or not, I've found no possibility to implement the following procedure:
1) link the video as source
2) do for every single movie frame (~12000)
2.1) get the actual frame as PImage
2.2) do some calculations, compress the Image as JPEG in five different quality settings (by saving, reading out the values, and deleting these temporary images), append the results to a log file
2.3) free up memory
The pause() and play() methods of GSStreamer are much too coarse, I tried to consecutively pause and resume the video, however, only about every 10th frame can be accesed this way. I'm aware that videos are compressed by default and only every n-th framed is contained as full image in a movie file; but I'd like to assess every frame as it is displayed on screen, i.e., what is actually visible after the renderer has generated the respective frame. Does anyone have an idea or a link to a library that would allow for this procedure in processing?
Cheers! Marius
Answers
do you have to use processing for this? when i've done something similar i've just used mplayer and a little bash script to extract frames on linux.
Windows user here ... ;-) I thought of Processing, as I've used it often for rendering, video playing; and foremost, as stuff like "Save as JPEG" would be a one-liner, and all the logging-stuff could be neatly done with Java.
I'm refraining a bit from using a solution that extracts every frame to an image at once, with 12,000 TIFF-Images resulting, HD space would get an issue (OK, I could write to our server, but the frame-by-frame-approach seems more efficient). Furthermore, once it works it might be we extend this approach to movie files with runtimes of, say, two hours, so I would prefer a streaming approach I could run on a machine dedicated to this task.
mplayer runs on windows. and vlc will do something similar, i believe.
and both take a start and end time so you can do it in batches, say 5 minutes of footage at a time, to cut down on disk usage. (i've used it for mosaics, grabbing one frame per minute from a two hour film. also for slitscan stuff, grabbing one column of pixels from each frame of a 10 minute pop video)
but the DOS scripting, you're on your own there 8)
I've used ffmpeg for extracting frames from the command line. It's available on Mac, Windows and Linux. I wonder if it would be possible to use pipes to grab the frames one by one as provided by ffmpeg. Here there is something about ffmpeg and pipes: http://superuser.com/questions/322216/how-can-i-pipe-output-of-ffmpeg-to-ffplay
Someone can send me the librery GSVideo? I can not download it from the website