<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -606,8 +606,16 @@ RESPONSE
   
   # Encoding
   # ========
+  def self.update_metadata_if_needed(video)
+    if video.width.to_i == 0 || video.height.to_i == 0
+      video.read_metadata
+      video.save
+    end
+  end
   
   def ffmpeg_resolution_and_padding
+    # if we don't have a width, try reading meta data
+    Video.update_metadata_if_needed(self.parent_video)
     # Calculate resolution and any padding
     in_w = self.parent_video.width.to_f
     in_h = self.parent_video.height.to_f
@@ -641,6 +649,7 @@ RESPONSE
   end
   
   def ffmpeg_resolution_and_padding_no_cropping
+    Video.update_metadata_if_needed(self.parent_video)
     # Calculate resolution and any padding
     in_w = self.parent_video.width.to_f
     in_h = self.parent_video.height.to_f</diff>
      <filename>app/models/video.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a9610878c54a15b5553e82629a9230c01f2307bf</id>
    </parent>
  </parents>
  <author>
    <name>Josh Starcher</name>
    <email>josh@josh-starchers-mac-pro.local</email>
  </author>
  <url>http://github.com/twinge/panda/commit/25fadba049c197a1e35d3bf5bc54069e7c17c2e6</url>
  <id>25fadba049c197a1e35d3bf5bc54069e7c17c2e6</id>
  <committed-date>2009-11-10T09:34:11-08:00</committed-date>
  <authored-date>2009-11-10T09:34:11-08:00</authored-date>
  <message>when encoding, if meta data is missing, get it</message>
  <tree>d3703c33d67bc24a25d66012bf59410c8a4694dc</tree>
  <committer>
    <name>Josh Starcher</name>
    <email>josh@josh-starchers-mac-pro.local</email>
  </committer>
</commit>
