Category: |
GUI Programming |
Author/Contact Info |
zentara of perlmonks |
Description: |
Want to make a highly succesful how-to to put on You-Tube? Or maybe speed up looking thru your security camera still images? Here you go....put a sequential list of jpg's in a subdir, and run this script on it. The output flv is conveniently named as 111****.flv so as to be at the top of your dir list. :-) A sample of me fixing a lamp is lamp_fix |
#!/usr/bin/perl
use warnings;
use strict;
# Usage: $0 'a_video_subdir_full_of_sequential_jpgs'
$|++;
my $videodir = shift || 'lamp_fix';
#put the video at the top of the long image list
my $video = $videodir.'/111'.$videodir.'.flv';
# recombine
recombine();
print "done\n";
exit;
###################################################
sub recombine{
opendir my $dh, $videodir or die "Error: $!\n";
my @files = grep !/^\.\.?$/, readdir $dh;
@files = grep /^(.*)\.jpg$/, @files;
closedir $dh;
#print "@files\n";
#audio options left in just incase you want to try adding audio
my @moptions =( 'mencoder',
"mf://$videodir/*.jpg",
'-mf', 'fps=29.97', #NTSC tv video rate in
# '-audiofile', "$base.wav",
'-srate', 22050,
'-o', $video,
'-ovc', 'lavc',
'-lavcopts', 'vcodec=mpeg4:vbitrate=100',
# '-oac', 'mp3lame',
# '-audio-delay', 0.2, #adjust for audio syncing problems
);
system(@moptions);
}
############3
|
Re: Recombine still image sequences into movies
by grinder (Bishop) on Feb 25, 2009 at 19:42 UTC
|
Dear Sir,
I put 386502 jpg files in a directory and downloaded and installed ur program and now my computer seems to be realslow. Please to advice as 2 how 2 fix this problem.
...
Nah seriously, zentara, this is a very cool hack. I've got some fractal experiments lying around... and, I see mencoder can digest png files as well. Hmm, this could be interesting. ++
update: wow, that is a most surreal lamp-fixing video event. (i.e. if only VLC knew how to play it back at a reasonable frame-rate :)
• another intruder with the mooring in the heart of the Perl
| [reply] [Watch: Dir/Any] |
|
Yeah the lamp_fix jpg's come from my security camera setup to capture "on motion detect". I'm sure there is a frame delay option in mencoder, to slow down the play.I'm toying with the idea used on TV now, where they take a still image, and make a portion a floater (like the mouth opening /closing on a Bush image) so you could make pseudo-animated cartoons of images, maybe with a sound track. Open an person's image on a Tk::Canvas, then draw a lasso around the mouth, and drag the lasso with a mouse, saving at intermediate steps, to give the crude effect of talking or singing.....then lay a sound track on it.
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
Re: Recombine still image sequences into movies
by puudeli (Pilgrim) on Feb 26, 2009 at 08:27 UTC
|
Hmm, you go through some effort to sort the directory contents and put them into @files but it is not used in anywhere? You simply glob the directory contents on the mencoder command line. Is there some really magical going on that a mere monk does not see?
--
seek $her, $from, $everywhere if exists $true{love};
| [reply] [Watch: Dir/Any] [d/l] [select] |
Re: Recombine still image sequences into movies
by Lawliet (Curate) on Feb 25, 2009 at 20:32 UTC
|
/me thinks you really just wanted to show everyone you can fix a lamp and the program was an excuse to do so :P
I recommend motion for your webcam needs, by the way :)
And you didn't even know bears could type.
| [reply] [Watch: Dir/Any] |
Re: Recombine still image sequences into movies
by zentara (Archbishop) on Feb 26, 2009 at 13:43 UTC
|
./img-20090226-083619-0.jpg
./img-20090226-083619-1.jpg
./img-20090226-083620-0.jpg
So no sorting needed! :-)
I figured that you could record audio, while capturing the stop motion, and add understandable synchronized audio, at a real rate, to the fast motion video. I noticed that MSNBC's parodies of Rush Limbaugh uses this technique.
| [reply] [Watch: Dir/Any] [d/l] |
|
|