I open a filehandle to ffmpeg for that:

package External::FFmpeg; use parent 'Class::Accessor'; __PACKAGE__->mk_accessors(qw(width height depth pid stream texture_id +file)); sub spawn { my ($self,$cmd) = @_; my $pid = open my $stream, $cmd or die "Couldn't spawn '$cmd': $!/$?"; binmode $stream; return ($pid,$stream) }; sub DESTROY { if (my $pid = $_[0]->pid) { kill 9, $pid }; }; package Target::FFmpeg; use strict; use parent -norequire => 'External::FFmpeg'; sub new { my ($class,%args) = @_; my $file = delete $args{filename}; my $width = delete $args{width} || 352; my $height = delete $args{height} || 288; my $in_width = delete $args{in_width} || $width; my $in_height = delete $args{in_height} || $height; my $depth = 3; my ($pid,$stream) = $class->spawn(qq{| bin\\ffmpeg-old.exe -y -f r +awvideo -pix_fmt rgb24 -s ${in_width}x${in_height} -i "-" -f mpeg2vid +eo -s ${width}x${height} "$file"}); my $self = $class->SUPER::new({ width => $width, height => $height, depth => $depth, stream => $stream, pid => $pid, %args, }); $self };

Then I just print each frame (in RGB-format) to the filehandle and let ffmpeg work its magic. You could also try to get FFMpeg to compile+install, but I found using a binary far more convenient.


In reply to Re: Encoding Video by Corion
in thread Encoding Video by worldsight

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.