Simple Extension for Image Sequences

Bug #640579 reported by Beat Trachsler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Firefogg
Fix Released
Undecided
Unassigned
Nominated for Trunk by Beat Trachsler

Bug Description

With the following few lines inserted after line 730 in Firefogg.js the Firefogg plugin could also read image sequences and generate a web video out of them. This would be great for people using raytracers like povray to generate their videos.

 //new code for image sequences, 16.09.2010
 //compute file suffix
 var selectedPath = fp.file.path;
 var ppii = selectedPath.lastIndexOf(".");
 var suffix = selectedPath.substring(ppii,selectedPath.length);
 //ffmpeg path for image sequence:
 if(suffix == ".bmp" || suffix == ".png" || suffix == ".gif" || suffix == ".jpg" || suffix == ".jpeg")
 {
  var bodyPath = selectedPath.substring(0,ppii-1);
  var digits = 1;
  while(bodyPath.substr(bodyPath.length-1,1)=="0")
  {
   digits=digits+1;
   bodyPath = bodyPath.substring(0,bodyPath.length-1);
  }
  file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
  file.initWithPath(bodyPath.concat("%0"+digits+"d").concat(suffix));
 }
 //end code for image sequences

 this._inputFile = file.path; // modified: "file" instead of "fp.file", 16.09.2010
 this.sourceFilename = file.leafName; // modified: "file" instead of "fp.file", 16.09.2010

Comment: If the file type of the input source is recognized as one of the known image formats a file mask of the form "<filename>%0nd.***" is generated where n is the number of digits for the sequence. This format ist well supported by ffmpeg as shown at http://www.ffmpeg.org/faq.html#SEC14.

Revision history for this message
Beat Trachsler (beat-trachsler) wrote :
Revision history for this message
j^ (j) wrote :

commited something based on this in http://bazaar.launchpad.net/~j/firefogg/trunk/revision/223
right now it would only work if the image is foo0000.jpg are sequences starting with 1 common?

Changed in firefogg:
status: New → Fix Committed
Revision history for this message
Beat Trachsler (beat-trachsler) wrote :

Thanks a lot for the optimization of my code. It look's fine.
And yes, most of our sequences are starting with 1. Therefore I propose the following at line 816 of our _detect_image_sequence function:

 while(prefix.substr(prefix.length-1, 1) == "0"
   || (digits == 0 && prefix.substr(prefix.length-1, 1) == "1")) {

This should make the job!

j^ (j)
Changed in firefogg:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.