DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Win32 Ffmpeg Fetch Video Duration

01.09.2009
| 6501 views |
  • submit to reddit
        // get video duration through shell using ffmpeg on windows

s = `ffmpeg -i x:\\dir\file.wmv 2>&1`
if s =~ /Duration: ([\d][\d]):([\d][\d]):([\d][\d]).([\d]+)/
  hours = $1
  mins = $2
  seconds =$3
  fractions = $4
end