Time for Friday afternoon fun!!

Ever want to make one of those animated videos, like are currently popular on american tv, that are obviously recorded, yet appear to be drawn? Here is a 1 shot script to do it. A more powerful program to do this is Lives

A sample video is at a sample from youtube and it's charcoal version in avi format and it's charcoal in flv format

UPDATE: See comments below on how to convert the avi output back to flv output. (to address grandfather's problem on XP)

#!/usr/bin/perl use warnings; use strict; use File::Path qw(rmtree); use Image::Magick; # Usage: $0 colors.flv OR $0 r # The r option will skip ripping and recombine # the contents of the riptemp-$base subdir. # This allows you to manually edit individual files. # If more than 2 riptemp dirs are present, the first # in a dirlist will be used. So.... work on 1 at a time # in their own directories. This is just a snippet. :-) # I admit, that the Lives (Linux Video Editing System) # at http://lives.sourceforge.net/ # is much more powerful than this. Check it out, and # it's "smogrify" perl script.... which is it's workhorse. $|++; my $video = shift || 'colors.flv'; my $base; if($video eq 'r'){ recombine(); }else{ $video =~ /^(.+)(\.\w+)$/; $base = $1; } #rip to jpg's and audio #will make it's own temp dir my @moptions =( 'mplayer', '-osdlevel', 0, '-vo', "jpeg:quality=100:outdir=riptemp-$base:maxfiles +=2000", '-noframedrop', #important for quality '-ao', "pcm:file=$base.wav", $video, ); system(@moptions); opendir my $dh, "riptemp-$base" or die "Error: $!\n"; my @files = grep !/^\.\.?$/, readdir $dh; closedir $dh; my $p = new Image::Magick; #only make one and reuse my $max = scalar @files; my $count = 0; foreach my $file ( @files ) { # operate on jpgs for effects $count++; print "\rprocessing file $count/$max"; $p->Read("riptemp-$base/$file"); $p->Negate(); $p->Charcoal('0x1'); $p->Write("riptemp-$base/$file"); undef @$p; #clear out object data } print "\n\nDone effects processing\n\n"; ##################### # recombine recombine(); #ask to keep clips or not print "\n\nDone! Delete temp clips? (n/y) Defaults to n\n"; my $return = <>; if($return =~ /^[yY].*$/){ rmtree("riptemp-$base", 0, 1); # verbose report, and ignore undelete +ables }else{exit} ##################################################################### sub recombine{ opendir my $dh, '.' or die "Error: $!\n"; my @files = grep !/^\.\.?$/, readdir $dh; @files = grep /^riptemp-(.*)$/, @files; closedir $dh; my $dir = $files[0]; $dir =~ /^riptemp-(.*)$/; my $base = $1; #print "$dir\t$base\n"; my @moptions =( 'mencoder', "mf://$dir/*.jpg", '-mf', 'fps=29.97', #NTSC tv video rate in '-audiofile', "$base.wav", '-srate', 22050, '-o', "$base-char.avi", '-ovc', 'lavc', '-lavcopts', 'vcodec=mpeg4:vbitrate=100', '-oac', 'mp3lame', # '-audio-delay', 0.2, #adjust for audio syncing problems ); system(@moptions); } ###################################################################### +3

In reply to z-charcoal-video-converter by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.