Skip to content

A basic ffmpeg -> AVAudioEngine audio player written in Swift (demo project).

License

Notifications You must be signed in to change notification settings

kartik-venugopal/swift-ffmpeg-player

Repository files navigation

FFmpeg Player

What ?

A basic audio player that demonstrates the use of ffmpeg together with AVAudioEngine ... written in Swift.

Screenshot

In a few more words, ...

High level component diagram

  • Demuxing an audio file into streams - audio and image (cover art).
  • Reading packets from an audio stream, and using a codec to decode the packets into PCM samples.
  • Extracting metadata (artist/album, cover art, etc).
  • Converting between different PCM sample formats (resampling).
  • Constructing audio buffers with the PCM samples, and scheduling them for playback.
  • Upmixing/downmixing from mono/surround audio to stereo.
  • Seeking within a stream - by frame or byte position.
  • Building a packet table when no duration or bit rate info is available, to compute duration and enable seeking.

Why ?

To help anyone who wants to get started with ffmpeg / AVAudioEngine but is having a hard time finding (or making sense of) documentation, tutorials, or concrete implementations out there. Take this project as a starting point or quick start guide, if nothing else.

I myself am still learning audio programming and ffmpeg, so I am simply passing on some of what I have learned.

Tip - To get the most out of this project, I recommend that you follow targodan's tutorial as you play with my demo app.

Other helpful resources