Coder Social home page Coder Social logo

ofxavfvideoplayer's Introduction

ofxAVFVideoPlayer allows openFrameworks apps to use the AV Foundation Framework for the best possible video playback on OSX 10.7+

Installation

  1. Clone this repository or copy its folder into the addons directory of openFrameworks
  2. Drag and drop the files in the src directory into your Xcode project
  3. Add the following system frameworks to your Xcode project (you can find them by right-clicking an existing system framework and selecting "show in finder"):
    • CoreMedia.framework
    • QuartzCore.framework
    • AVFoundation.framework

Usage

ofxAVFVideoPlayer has an interface based on ofVideoPlayer. If you are using OSX 10.7 (Lion) or newer, it should be more or less a drop-in replacement. One major difference is that all media is loaded asynchronously, so there is an additional isLoaded() method on ofxAVFVideoPlayer to check if the file has completed loading. Any playback controls invoked before isLoaded() == true are not guaranteed to have an effect. Loading should happen very fast under most circumstances.

ofxAVFVideoRenderer is the native Objective-C code which creates and renders the video player object. You shouldn't interface with it directly.

Performance

Loading and rendering should be very fast. Tests on a recent iMac show 10 HD ProRes 422 videos playing back simultaneously at about 30fps. Unlike the approach taken in ofxiPhone's AVFoundation implementation, the video is never processed by the CPU and the pixel data is never copied from video memory (unless you call getPixels(), which will copy the pixels from video memory no more than once for every time you call update [which should be once per frame])).

As far as I can tell, AV Foundation is the same framework that Quicktime X and Finder use for video playback, so you should get performance similar to what you can achieve by opening up a bunch of video files directly from Finder. This is much faster than the original ofVideoPlayer and has better multi-threaded and multi-video support than the QTKit framework.

License

This addon is Copyright (C) 2013 Sosolimited and released under an MIT license. Use it as you wish, but keep the license file with it! See LICENSE.txt for more info.

ofxavfvideoplayer's People

Contributors

kronick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxavfvideoplayer's Issues

nextFrame() / setFrame()

Hi,

This is great - the speed is so much better. Any chance you have implemented nextFrame() / setFrame() as my project requires this functionality, and I'm not sure where to begin.

Cheers,
David

video translation on 10.9 mavericks fixed

hi kronick

for some reason the video was translated in osx mavericks

in ofxAVFVideoRenderer i fixed this by

self.layerRenderer.bounds = CGRectMake(0, 0, videoSize.width, videoSize.height);
[self.layerRenderer.layer setAnchorPoint:CGPointMake(0.0, 0.0)];

and commenting out the translation in the render function...

everything renders fine now from 10.7 to 10.9

greetings ascorbin

Error: "Could not load the stdlib module"

Hello I am running xCode 7.1 with OSX 10.11.1 and there is an error on in #include <gst/gst.h> on ofGstUtils.h :

Couldn't Generate Swift Representation
Error (from SourceKit):
"Could not load the stdlib module"

May I ask if there is any suggestions to fix this please?

Cheers,
Karen

Build Error

Hey,

When I'm trying to build my project I'm getting an error on line 42(in ofxAVFVideoPlayer.h) saying:
Virtual function 'getPixels' has a different return type ('unsigned char *') than the function it overrides (which has return type 'ofPixels_<unsigned char> &')
Am I doing something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.