<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Encoding media files in Ruby using ffmpeg/mencoder with progress tracking</title>
	<atom:link href="http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/feed/" rel="self" type="application/rss+xml" />
	<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/</link>
	<description>In my blog I'll try to describe about interesting technologies, my discovery in IT and some useful things about programming.</description>
	<lastBuildDate>Tue, 29 Dec 2009 10:34:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Lele</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-215752</link>
		<dc:creator>Lele</dc:creator>
		<pubDate>Thu, 18 Mar 2010 15:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-215752</guid>
		<description>Hi,
I&#039;m trying to do something similar to what you did.
One thing I&#039;m trying to add now is a timeout, what I would like to do is to check if I get some output from mencoder, if I don&#039;t get any output on the stdour or error for more that 30 sec I want to quit the process.
Is that possible?
thanks very much in advance</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I&#8217;m trying to do something similar to what you did.<br />
One thing I&#8217;m trying to add now is a timeout, what I would like to do is to check if I get some output from mencoder, if I don&#8217;t get any output on the stdour or error for more that 30 sec I want to quit the process.<br />
Is that possible?<br />
thanks very much in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-215571</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 18 Mar 2010 18:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-215571</guid>
		<description>The ffmpeg progress counter will never update with Ruby 1.8.6 because duration is defined out of scope (the first if clause) when processing each line from ffmpeg&#039;s output (the second if clause) -- to fix it, change the line: &quot;progress = nil&quot; to &quot;duration = progress = nil&quot; and it will work fine.</description>
		<content:encoded><![CDATA[<p>The ffmpeg progress counter will never update with Ruby 1.8.6 because duration is defined out of scope (the first if clause) when processing each line from ffmpeg&#8217;s output (the second if clause) &#8212; to fix it, change the line: &#8220;progress = nil&#8221; to &#8220;duration = progress = nil&#8221; and it will work fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: benok</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-153066</link>
		<dc:creator>benok</dc:creator>
		<pubDate>Thu, 18 Mar 2010 02:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-153066</guid>
		<description>Hi, do you know this library?
It&#039;s very handy.
http://0xcc.net/ruby-progressbar/index.html.en</description>
		<content:encoded><![CDATA[<p>Hi, do you know this library?<br />
It&#8217;s very handy.<br />
<a href="http://0xcc.net/ruby-progressbar/index.html.en" rel="nofollow">http://0xcc.net/ruby-progressbar/index.html.en</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-142496</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Thu, 18 Mar 2010 00:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-142496</guid>
		<description>Hi , Thanks for this tutorial. 
I am on leopard FFmpeg version SVN-r9102, ruby 1.8.6.
The above code works fine for me but the progress wont update sequentially as expected. 

Any idea what this could be?? Is it something to do with pipe.each(&quot;\r&quot;) ??</description>
		<content:encoded><![CDATA[<p>Hi , Thanks for this tutorial.<br />
I am on leopard FFmpeg version SVN-r9102, ruby 1.8.6.<br />
The above code works fine for me but the progress wont update sequentially as expected. </p>
<p>Any idea what this could be?? Is it something to do with pipe.each(&#8220;\r&#8221;) ??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Руслан Разбежкин</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-130540</link>
		<dc:creator>Руслан Разбежкин</dc:creator>
		<pubDate>Thu, 18 Mar 2010 11:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-130540</guid>
		<description>Помогите решить вот такую проблему:
конвертирую flv в mov
на входе 8 Мб
на выходе 51 Мб, т.е. в 6 раз больше.

команда такая:
ffmpeg -i sqlintro1.flv -sameq 01sql.mov

Подскажите, если не затруднит, какими ключами можно уменьшить размер выходного файла, чтобы он был примерно таким же как и входной.</description>
		<content:encoded><![CDATA[<p>Помогите решить вот такую проблему:<br />
конвертирую flv в mov<br />
на входе 8 Мб<br />
на выходе 51 Мб, т.е. в 6 раз больше.</p>
<p>команда такая:<br />
ffmpeg -i sqlintro1.flv -sameq 01sql.mov</p>
<p>Подскажите, если не затруднит, какими ключами можно уменьшить размер выходного файла, чтобы он был примерно таким же как и входной.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links, ideas and geek stuff &#187; Blog Archive &#187; links for 2007-10-19</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-110892</link>
		<dc:creator>links, ideas and geek stuff &#187; Blog Archive &#187; links for 2007-10-19</dc:creator>
		<pubDate>Thu, 18 Mar 2010 03:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-110892</guid>
		<description>[...] Encoding media files in Ruby using ffmpeg/mencoder with progress tracking [...]</description>
		<content:encoded><![CDATA[<p>[...] Encoding media files in Ruby using ffmpeg/mencoder with progress tracking [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Converting movies to flv format. &#171; nuby on rails</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-88316</link>
		<dc:creator>Converting movies to flv format. &#171; nuby on rails</dc:creator>
		<pubDate>Thu, 18 Mar 2010 23:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-88316</guid>
		<description>[...] going with a different guide [...]</description>
		<content:encoded><![CDATA[<p>[...] going with a different guide [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baerz</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-63129</link>
		<dc:creator>Baerz</dc:creator>
		<pubDate>Thu, 18 Mar 2010 12:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-63129</guid>
		<description>Hey, works :) Thanks...</description>
		<content:encoded><![CDATA[<p>Hey, works :) Thanks&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmytro Shteflyuk</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-63125</link>
		<dc:creator>Dmytro Shteflyuk</dc:creator>
		<pubDate>Thu, 18 Mar 2010 12:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-63125</guid>
		<description>Baerz, you should define methods &lt;tt&gt;execute_mencoder&lt;/tt&gt; and &lt;tt&gt;execute_ffmpeg&lt;/tt&gt; &lt;strong&gt;before&lt;/strong&gt; executing them, for example, right after definition of the class &lt;tt&gt;MediaFormatException&lt;/tt&gt;.</description>
		<content:encoded><![CDATA[<p>Baerz, you should define methods <tt>execute_mencoder</tt> and <tt>execute_ffmpeg</tt> <strong>before</strong> executing them, for example, right after definition of the class <tt>MediaFormatException</tt>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baerz</title>
		<link>http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-63120</link>
		<dc:creator>Baerz</dc:creator>
		<pubDate>Thu, 18 Mar 2010 12:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/ruby-on-rails/encoding-media-files-in-ruby-using-ffmpeg-mencoder-with-progress-tracking/#comment-63120</guid>
		<description>Hi, i tried to implement your Script, but it will not work for me. I get an Error: undefined method `execute_mencoder&#039; for main:Object (NoMethodError)

Why? :)

&lt;code lang=&quot;ruby&quot;&gt;
class MediaFormatException &lt; StandardError
end


command_mencoder = &quot;/usr/bin/mencoder /home/download/medien_trailer.mov -o /home/robin/download/output.avi -oac lavc -ovc lavc -lavcopts vcodec=xvid:acodec=mp3&quot;
command_ffmpeg = &quot;/usr/bin/ffmpeg -y -i /home/download/medien_trailer.mov -vcodec xvid -acodec mp3 -ab 96 /home/robin/download/output.avi 2&gt;&amp;1&quot;

begin
  execute_mencoder(command_mencoder)
  execute_ffmpeg(command_ffmpeg)
rescue
  print &quot;ERROR\n&quot;
  exit 1
end

def execute_mencoder(command)
  progress = nil
  Open3.popen3(command) do &#124;pipe&#124;
    pipe.each(&quot;\r&quot;) do &#124;line&#124;
      if line =~ /Pos:[^(]*(\s*(\d+)%)/
        p = $1.to_i
        p = 100 if p &gt; 100
        if progress != p
          progress = p
          print &quot;PROGRESS: #{progress}\n&quot;
          $defout.flush
        end
      end
    end
  end
  raise MediaFormatException if $?.exitstatus != 0
end

def execute_ffmpeg(command)
  progress = nil
  Open3.popen3(command) do &#124;pipe&#124;
    pipe.each(&quot;\r&quot;) do &#124;line&#124;
      if line =~ /Duration: (\d{2}):(\d{2}):(\d{2}).(\d{1})/
        duration = (($1.to_i * 60 + $2.to_i) * 60 + $3.to_i) * 10 + $4.to_i
      end
      if line =~ /time=(\d+).(\d+)/
        if not duration.nil? and duration != 0
          p = ($1.to_i * 10 + $2.to_i) * 100 / duration
        else
          p = 0
        end
        p = 100 if p &gt; 100
        if progress != p
          progress = p
          print &quot;PROGRESS: #{progress}\n&quot;
          $defout.flush
        end
      end
    end
  end
  raise MediaFormatException if $?.exitstatus != 0
end
&lt;/code&gt;

</description>
		<content:encoded><![CDATA[<p>Hi, i tried to implement your Script, but it will not work for me. I get an Error: undefined method `execute_mencoder&#8217; for main:Object (NoMethodError)</p>
<p>Why? :)</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> MediaFormatException <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#CC00FF; font-weight:bold;">StandardError</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
<br />
command_mencoder = <span style="color:#996600;">&quot;/usr/bin/mencoder /home/download/medien_trailer.mov -o /home/robin/download/output.avi -oac lavc -ovc lavc -lavcopts vcodec=xvid:acodec=mp3&quot;</span><br />
command_ffmpeg = <span style="color:#996600;">&quot;/usr/bin/ffmpeg -y -i /home/download/medien_trailer.mov -vcodec xvid -acodec mp3 -ab 96 /home/robin/download/output.avi 2&gt;&amp;1&quot;</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">begin</span><br />
&nbsp; execute_mencoder<span style="color:#006600; font-weight:bold;">&#40;</span>command_mencoder<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; execute_ffmpeg<span style="color:#006600; font-weight:bold;">&#40;</span>command_ffmpeg<span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color:#9966CC; font-weight:bold;">rescue</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">print</span> <span style="color:#996600;">&quot;ERROR<span style="color:#000099;">\n</span>&quot;</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">exit</span> 1<br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">def</span> execute_mencoder<span style="color:#006600; font-weight:bold;">&#40;</span>command<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; progress = <span style="color:#0000FF; font-weight:bold;">nil</span><br />
&nbsp; Open3.<span style="color:#9900CC;">popen3</span><span style="color:#006600; font-weight:bold;">&#40;</span>command<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>pipe<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; pipe.<span style="color:#9900CC;">each</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\r</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>line<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>Pos:<span style="color:#006600; font-weight:bold;">&#91;</span>^<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>\s<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">%</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">p</span> = $1.<span style="color:#9900CC;">to_i</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">p</span> = 100 <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC0066; font-weight:bold;">p</span> <span style="color:#006600; font-weight:bold;">&gt;</span> 100<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> progress != <span style="color:#CC0066; font-weight:bold;">p</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; progress = <span style="color:#CC0066; font-weight:bold;">p</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">print</span> <span style="color:#996600;">&quot;PROGRESS: #{progress}<span style="color:#000099;">\n</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#ff6633; font-weight:bold;">$defout</span>.<span style="color:#9900CC;">flush</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">raise</span> MediaFormatException <span style="color:#9966CC; font-weight:bold;">if</span> $?.<span style="color:#9900CC;">exitstatus</span> != 0<br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">def</span> execute_ffmpeg<span style="color:#006600; font-weight:bold;">&#40;</span>command<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; progress = <span style="color:#0000FF; font-weight:bold;">nil</span><br />
&nbsp; Open3.<span style="color:#9900CC;">popen3</span><span style="color:#006600; font-weight:bold;">&#40;</span>command<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>pipe<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; pipe.<span style="color:#9900CC;">each</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\r</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>line<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>Duration: <span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span>2<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>:<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span>2<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>:<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span>2<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">&#123;</span>1<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; duration = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>$1.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">*</span> 60 <span style="color:#006600; font-weight:bold;">+</span> $2.<span style="color:#9900CC;">to_i</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">*</span> 60 <span style="color:#006600; font-weight:bold;">+</span> $3.<span style="color:#9900CC;">to_i</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">*</span> 10 <span style="color:#006600; font-weight:bold;">+</span> $4.<span style="color:#9900CC;">to_i</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>time=<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">not</span> duration.<span style="color:#0000FF; font-weight:bold;">nil</span>? <span style="color:#9966CC; font-weight:bold;">and</span> duration != 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">p</span> = <span style="color:#006600; font-weight:bold;">&#40;</span>$1.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">*</span> 10 <span style="color:#006600; font-weight:bold;">+</span> $2.<span style="color:#9900CC;">to_i</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">*</span> 100 <span style="color:#006600; font-weight:bold;">/</span> duration<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">p</span> = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">p</span> = 100 <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC0066; font-weight:bold;">p</span> <span style="color:#006600; font-weight:bold;">&gt;</span> 100<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> progress != <span style="color:#CC0066; font-weight:bold;">p</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; progress = <span style="color:#CC0066; font-weight:bold;">p</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">print</span> <span style="color:#996600;">&quot;PROGRESS: #{progress}<span style="color:#000099;">\n</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#ff6633; font-weight:bold;">$defout</span>.<span style="color:#9900CC;">flush</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">raise</span> MediaFormatException <span style="color:#9966CC; font-weight:bold;">if</span> $?.<span style="color:#9900CC;">exitstatus</span> != 0<br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>
]]></content:encoded>
	</item>
</channel>
</rss>
