[Libav-user] Would anyone find an OS X / Cocoa / Swift wrapper for Libav useful?

Thomas Worth dev at rarevision.com
Sun Jan 25 13:53:57 CET 2015

> Perhaps I’m the only one on the planet using Libav on Apple platforms,
> though I’m betting I’m not (actually I know I’m not, as a few have
> contacted me off-list). Also, it might take some of the headache away from
> the Libav devs who don’t use Apple platforms to answer some support
> questions. For us who like apples, a nice, clean Swift API might be very
> nice, and save a lot of time and headaches. I might be able to produce such
> a thing, first somewhat limited and rudimentary, and then mature it over
> time.
> Would anyone be interested in such an API?

I'll add my thoughts as someone who has spent plenty of sleepless nights
dissecting ffmpeg.

Right off the bat, I'll say the ffmpeg/libav C API works perfectly well on
Mac OS X. I don't see how switching the API to work with another, possibly
less-supported language would be advantageous. Mac OS X and iOS development
is already typically done in C/Objective-C, so the API just works as-is.
Most of the "under the hood" code I write is done in C for maximum
portability, and so I have not had any issues with ffmpeg/avcodec/avformat,
etc. on a Mac. It just... works. Period. It even works on Windows, which is
amazing. But not really. Why? C. Bravo.

That said, the ffmpeg APIs are pretty low-level. Their functionality
(especially avformat) in my view is very much governed by the file format
containers. What helped me understand the way these APIs work is to learn
the file formats in-and-out. I primarily work with MOV/MP4 files, and
learning the timings and the way the data is stored in those containers
gave me tremendous insight into the way avformat works. AVFoundation, in
many ways, works like avformat and it's because both of the APIs' behavior
is dictated by the file formats. Learn the file formats, and things become
much more clear.

There's also been a lot of complaints about the seek API. I'll say this:
frame-accurate seeking is absolutely possible with ffmpeg, even with GOP
formats. However, there's a lot of additional work you need to do for this
to be practical, and I'm not sure there's a "one size fits all" solution to
this. So, if you feel like spending a few days figuring this out, it's
doable. It just depends on how committed you are.

I sympathize with your situation, Brad. It took me a good while to get up
to speed, and there was certainly more than one instance where I would just
stare at a bunch of code on the screen and yell, "WHY THE FUCK DOESN'T THIS
WORK?!" But, after sticking with it, reading the ffmpeg headers (yep,
that's your documentation) and experimenting, the puzzle started coming
together. I've written my own C library for common things that works the
way I want it to for my coding style, and now new development goes much
more quickly. You might try doing something similar. That is, once you've
recovered from tearing all your hair out. ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150125/c2ba5498/attachment.html>

More information about the Libav-user mailing list