[Tfug] ffmpeg to SQL
Choprboy
choprboy at dakotacom.net
Thu Jan 3 14:15:24 MST 2008
On Thursday 03 January 2008 09:21, Claude Rubinson wrote:
> On Thu, Jan 03, 2008 at 04:47:18AM -0700, Choprboy wrote:
> > I anybody familiar with a plugin or undocumented option for inserting
> > frames captured/processed with ffmpeg into a SQL database???
>
> Not answering your question but why do you want to store the video
> frames themselves in the db? My rule of thumb (and, obviously, it's
> just a rule of thumb) is to avoid defining blob types whenever
> possible. My preferred solution is to store the blob as a file and a
> pointer to the blob in the db (generally just the filename). Another
> way of asking the question: what do you get by storing the blob in the
> database?
Well... I don't necessarily need to store the image blob in the database
itself, a filename with other data in the table would be fine. I was thinking
a DB overall for several reasons:
1) I need a good (relatively so <~0.25-0.5sec) timestamp for each datapoint. I
figured that trying to use a file date stamp, or trying to code something
into each individual frame filename, would be a pain in the butt to handle.
Seemed like a timestamp on INSERT would be easy to do.
2) I need to correlate two different data sources, with different update rates
and variability, and extrapolate data in missing points. One dataset will be
1fps time/location/environment, the other will vary ~0.1fps to 5fps or so
imagery. Given a single run may have ~40,000-50,000+ data points, I figured
an SQL query would probably be the easiest way to do so an extraction.
3) I want to post-process with different relative frame rates, say 0.5fps
final out of a 4fps dataset, and different output qualities (feeding back
into ffmpeg later to make movies). In addition, I want to be able to
mark/select bad/corrupted/poor quality frames in the dataset and ignore
those, instead selecting the nearest "good" frame (or extrapolating either
side) as a replacement. Again, I figured a column marker would be easiest to
keep track of these.
Unfortunately I have not been able to find a way to link the output
(filename/time/etc.) of ffmpeg to SQL directly... to trigger the INSERT of
frame filename/time/etc. The only way I have seen is to write a single frame,
exit, run a script (bash/perl/etc.) to do the SQL, and then run ffmpeg again.
That will turn the camera on/off repeatedly (V4L2), I'd rather let the camera
run and just save every nth frame. I'd really like to code something up in C,
linked against ffmpeg and SQL to do it... I just don;t think I have enough
time to relearn C and get it done before next week when I wanted to try it
out.
I am also looking at uvccapture and fswebcam, which allow you to run a command
on each frame output, but the framerate controls on both do not seem to be
working correctly (for that matter... ffmpeg at 1Hz doesn;t seem to work
either). I just started messing with the camera for several hours last night,
so maybe I just missed something.
Adrian
More information about the tfug
mailing list