video

Quartz VJ App

scalf's picture

I was curious if anybody else had made a composition in Quartz Composer for VJ or live video purposes?

I have found this to be one of the easiest environments to work in and I was curious if anybody had applied this ease to a full program that was robust and reliable enough to be used in live productions?

iOS video guru needed

Raconteur's picture

Hi gang,

I used to be an active member here a few years ago, but have gotten sidetracked. However, I remember, back then, thinking that if there was ever a group that could help solve just about ANY programming problem, it was you all.

So, that said, I have an iOS development issue that I am hoping someone has either figured out or can at least give some ideas on.

The following is posted, verbatim, on StackOverflow, so anyone who has seen it there (no replies at all so far), sorry for the redundancy.

I am having a hell of a time with AVQueuePlayer... Very simply, I am making it on an array of AVPlayerItems built with playerItemWithURL: and pointing to video assets on a server out on the Net.

If I try to run this thing in the stimulator (sic) it plays through the first asset, begins playing the second and just dies. Sometimes it doesn't even get through the first asset.

Now, I understand that the sim behaves differently than the device, so I tried it on the device as well, with the same problem.

When I log the various status changes on the item, I see that the buffer runs out, and the player just dies. This seems a bit silly to me for a construct that is supposed to play a queue of items... of course the buffer may underrun, but why would it just die?

Am I doing something wrong, or is this how it is supposed to behave?

I have gotten around this problem by observing the loadedTimeRanges property and when it changes sending PLAY to the player. But this results in stuttering playback, which sucks too.

Here is my code. Can someone please tell me how to do this without the playback being complete crap?

- (void)viewDidLoad {
    [super viewDidLoad];
 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handlePlayerItemReachedEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:self.queuePlayer];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handlePlayerStalled:) name:AVPlayerItemPlaybackStalledNotification object:self.queuePlayer];
 
    NSString *baseURL = @"http://www.aDomain.com/assets/";
    NSMutableArray *vidItemArray = [[NSMutableArray alloc] initWithCapacity:5];
 
    for (int i = 1; i <= 5; i++) {
        AVPlayerItem *vid = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:[baseURL stringByAppendingFormat:@"%d.mov", i]]];
        [vid addObserver:self forKeyPath:@"status" options:0 context:nil];
        [vid addObserver:self forKeyPath:@"playbackBufferEmpty" options:0 context:nil];
        [vid addObserver:self forKeyPath:@"loadedTimeRanges" options:0 context:nil];
        [vidItemArray addObject:vid];
    }
 
    self.queuePlayer = [AVQueuePlayer queuePlayerWithItems:vidItemArray];
    [self.mPlaybackView setPlayer:self.queuePlayer];
}
 
- (void)handlePlayerItemReachedEnd:(NSNotification *)notification {
    NSLog(@"Clip #%d finished playing", [self.queuePlayer.items indexOfObject:self.queuePlayer.currentItem]);
}
 
- (void)handlePlayerStalled:(NSNotification *)notification {
    NSLog(@"CLIP STALLED...");
}
 
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    if ([object isKindOfClass:[AVPlayerItem class]]) {
        AVPlayerItem *item = (AVPlayerItem *)object;
 
        if ([keyPath isEqualToString:@"status"]) {
            switch (item.status) {
                case AVPlayerItemStatusFailed:
                    NSLog(@"player item status failed");
                break;
                case AVPlayerItemStatusReadyToPlay:
                    NSLog(@"player item status is ready to play");
                [self.queuePlayer play];
                break;
                case AVPlayerItemStatusUnknown:
                    NSLog(@"player item status is unknown");
                break;
            }
        }
        else if ([keyPath isEqualToString:@"playbackBufferEmpty"]) {
            if (item.playbackBufferEmpty) {
                NSLog(@"player item playback buffer is empty");
            }
        }
        else if ([keyPath isEqualToString:@"loadedTimeRanges"]) {
            NSLog(@"Loaded time range = %@", item.loadedTimeRanges);
            self.queuePlayer play];
        }
    }
}

Movie Loader slowing down

zulli114's picture

I saw this posting on the movie loader and works pretty well.

great tutorial on movie loader. http://vjkungfu.com/archive/new-movie-loader-in-quartz-composer-for-snow...

They mention about changing the rate to slow it down.
Does anyone know where in the javascript I could do that instead of jumping frames. Always giving credit.

function (__number position, __boolean reset) main (__number inputNumber[8], __number duration) { var result = new Object(); var slice = duration/8;

if(inputNumber[0]>0){ result.position = slice*1-slice; result.reset = true; } else

if(inputNumber[1]>0){ result.position = slice*2-slice; result.reset = true; } else

if(inputNumber[2]>0){ result.position = slice*3-slice; result.reset = true; } else

if(inputNumber[3]>0){ result.position = slice*4-slice; result.reset = true; } else

if(inputNumber[4]>0){ result.position = slice*5-slice; result.reset = true; } else

if(inputNumber[5]>0){ result.position = slice*6-slice; result.reset = true; } else

if(inputNumber[6]>0){ result.position = slice*7-slice; result.reset = true; } else

if(inputNumber[7]>0){ result.position = slice*8-slice; result.reset = true; } else{ result.reset=false; }

return result; }

Efficient way to Black and White

scalf's picture

I have been using the stock Black and White patch to render any photo/video in BNW, however, this seems to be very costly to the CPU when used in a live video sense. Iw as wondering if there were any more effective ways to render a image source Black and White?

When I switch to BNW now I lose easily 50% of the frame rate and I know there must be a better way to do this. Any suggestions are much appreciated!

Mappit v1.2

scalf's picture

Just wanted to share the newest version of my video mapping software that was built in Quartz Composer. Mappit, as I call it, aims to be an entry level program useful for mapping out surfaces, building, shapes, etc with a projector. I consider it a very handy tool and I am sure someone will be able to make use of it.

In this version there are several upgrades including the interface, and the ways in which Mapp's are assembled and moved. This is of course free, and couldn't have been without the great help from this community.

Enjoy

http://communetohumanity.blogspot.com/p/software.html