Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Macman1993

macrumors 6502
Original poster
Nov 23, 2007
337
16
Hi,
I need the duration of a video that the user will provide in a program I'm writing (written in objective-c). Does anyone know a good way to do this? The video's will be in either flv or mp4 format, and I am using ffmpeg in my program already so if anyone knows a trick to get the duration with ffmpeg it would be greatly appreciated. Otherwise any general way of getting the duration would be great.

Thanks
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
From googling, looks like you can call it with -i argument, and then it'll output some info including the duration, which you can then parse as a string. You can use NSTask to execute it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.