Search code examples
rubyvideovideo-processing

can ruby tell me the length of web flv video? (ruby)


I am scraping forum website by type (article, webinar, video) I thought if ruby can extract somehow the length of the video. The corresponding html part of the web page looks like.

<div align="center"><script type="text/javascript" src="http://somedomain.com/wp-content/themes/thesis/custom/swfobject.js"></script>
 
<div id="player">This text will be replaced</div>
 
<script type="text/javascript">
var so = new SWFObject('http://somedomain.com/forum/yota/audio_player/player.swf','mpl','640','500','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('flashvars','&amp;file=http://somedomain.net/flv/ezinearticles/ezinearticles.flv&amp;dock=false');
so.write('player');
</script></div>

Interestingly I can access the flv file directly so I am happy to download all videos and then extract the length somehow. Majority of the files are flv some are wmv.

Please note that I have permission of the forum webmaster to do scraping.


Solution

  • ffmpeg-ruby looks like it does what you want.