Mar 142012

I don’t remember if I wrote this or snagged it off a forum post or what. It’ll create the trickmode bif file for a Roku DVP using the biftool bin in the SDK. I put biftool in /usr/local/bin/ on my system.

Contents of:


use File::Basename;
use File::Copy;
use File::Path;

if ($#ARGV != 1 ) {
        print "Scriptname Path File";


unless (-e $directory."/".$file) {
        print "File Doesn't Exist!\n";

# create the directories that we'll put the sequential images
mkdir "/tmp/".$file;

# for 4:3 SD Only
   system ("ffmpeg -i ".$directory."/".$file." -r .1 -s 240x180 "."/tmp/".$file."/%08d.jpg >> /tmp/".$file."-bif.log 2>&1");

   # Renumber images in directories to a zero-based index, required because
   # ffmpeg number starting from #1 which would put timing out by 10 secs
   opendir(DIR, "/tmp/".$file);
   @bifs = grep(/\.jpg$/,readdir(DIR));

   # Number of created frames to drop
   $dropnum = 0;
   for ($image_num = 0; $image_num < ($#bifs + 1) - $dropnum; $image_num++) {
      $oldnum = sprintf("%08d",($image_num+1) + $dropnum);
      $newnum = sprintf("%08d",$image_num);

   # now use biftool to create the bif files
   system("biftool -t 10000 "."/tmp/".$file);

   # delete the directories and the files in them

  One Response to “Roku Biftool Perl”

  1. Could you kindly provide a syntax example? I am sadly unable to interpret “Scriptname Path File” into anything meaningful.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>