acowley / ffmpeg-light

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

Use av_strerror for FFmpeg error messages? #42

Closed owickstrom closed 6 years ago

owickstrom commented 6 years ago

Hi! First of all, thanks for the library! I've just started using it to process and chop up videos and it's working nicely so far.

I had some trouble opening files and the error message thrown by readFile isn't very helpful. As seen in the following error message, it prints the numeric error code.

*** Exception: user error (ffmpeg failed opening file: -1094995529)
CallStack (from HasCallStack):
  error, called at src/Codec/FFmpeg/Juicy.hs:128:27 in ffmpeg-light-0.12.1.0-cf5adea21c23b3bea23fc219b84d9eaa2476dc02798ac7442955da596dc4c1b2:Codec.FFmpeg.Juicy

Do you think ffmpeg-light and the openFile function could use the av_strerror function in FFmpeg to map errors into strings? I could take a stab at sending a PR, but I'm not very experienced with C FFI in Haskell, so it might not be solid.

Thanks!

acowley commented 6 years ago

That is a terrific idea! Please do start a PR.