acowley / ffmpeg-light

Minimal Haskell bindings to the FFmpeg library
BSD 3-Clause "New" or "Revised" License
67 stars 29 forks source link

duration #38

Open anacrolix opened 6 years ago

anacrolix commented 6 years ago

I'm trying to get the duration of an input. I think something like what's done here: https://stackoverflow.com/questions/6451814/how-to-use-libavcodec-ffmpeg-to-find-duration-of-video-file. Is this exposed? I suspect something needs to added here? https://hackage.haskell.org/package/ffmpeg-light-0.12.0/docs/Codec-FFmpeg-Types.html#t:AVFormatContext

acowley commented 6 years ago

I think your analysis is all correct. I guess we'd put this in the Decode module, and we have to do something sensible for when the open input is a camera. We've got checkStreams which seems relevant to the caveat suggested by the SO answer you found. The last consideration would be to try to ensure we give an answer back in a friendly way (perhaps a Ratio).

Would you care to open a PR for this?