Improving playback performance - multiple player objects
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Improving playback performance - multiple player objects
Hi,
I have a stack with a size of 4096×2304 pixels (4K). On the stack I placed 100 player objects that each references a QT clip (260x260px,12 fps, MPEG-4 Video, Linear PCM). I would like to play all clips at approximately the same time. I am on a Macbook Pro 2011 model. As expected, the playback is very poor.(about 0.5 frames per seconds...) My question: What can I do in order to improve playback performance (besides upgrading Hardware)? Can I do something with Livecode (like buffering ???) that would make playback smoother across the 100 player objects? Which video codec is most "easy" to handle for livecode? Is there any other way to improve playback?
Thanks for any hint.
Oliver
I have a stack with a size of 4096×2304 pixels (4K). On the stack I placed 100 player objects that each references a QT clip (260x260px,12 fps, MPEG-4 Video, Linear PCM). I would like to play all clips at approximately the same time. I am on a Macbook Pro 2011 model. As expected, the playback is very poor.(about 0.5 frames per seconds...) My question: What can I do in order to improve playback performance (besides upgrading Hardware)? Can I do something with Livecode (like buffering ???) that would make playback smoother across the 100 player objects? Which video codec is most "easy" to handle for livecode? Is there any other way to improve playback?
Thanks for any hint.
Oliver
Re: Improving playback performance - multiple player objects
Hi Oliver,
1. welcome to the forum!
2. WOW, 100 player objects might be defintiely overkill and not only for Livecode!
I don't think you can optimize performance with 100 player objects at all!
I have been working on a video application and the maximum we could play smoothly on a
Mac Pro with a FAST harddisk (sic!) was up to 16 movies at the same time.
Maybe you could create ONE BIG movie from the clip(s) and try to play this single movie?
Know what I mean? Maybe at half teh dimensions and then double its size on screen?
Just a thought, at least worth a try
Codecs:
Since LC does actually NOT handle media playback, it simply passes it to the
underlying media playback engine of the current OS, there is no such thing as an "easy" to handle codec,
MP4 is a standard format and should do.
Best
Klaus.
1. welcome to the forum!

2. WOW, 100 player objects might be defintiely overkill and not only for Livecode!

I don't think you can optimize performance with 100 player objects at all!
I have been working on a video application and the maximum we could play smoothly on a
Mac Pro with a FAST harddisk (sic!) was up to 16 movies at the same time.
Maybe you could create ONE BIG movie from the clip(s) and try to play this single movie?
Know what I mean? Maybe at half teh dimensions and then double its size on screen?
Just a thought, at least worth a try

Codecs:
Since LC does actually NOT handle media playback, it simply passes it to the
underlying media playback engine of the current OS, there is no such thing as an "easy" to handle codec,
MP4 is a standard format and should do.
Best
Klaus.
Re: Improving playback performance - multiple player objects
Hi Klaus,
thanks for the quick response. This project is a sort of data visualisation, so the player objects will be positioned on a x/y axis according to different questions/options the user selects. Therefore it is difficult to create one big movie file beforehand. I also don't aim for smooth playback of 100 full HD clips, the clips are only 200x200 pixel, ca. 15 sec each, and I could live with something like 6-8 fps. So I believe it is doable, but it is on the edge, therefore I was looking for any "trick" to optimize the playback. How about layerMode or qtIdleRate or alwaysBuffer? Can I somehow "pre-load" the clips (since they are just about 2 MB each or in total ca. 2GB)? Is alwaysBuffer a property that works similar to some sort of a pre-load function? But than the dictionary says:
When you say, LC only passes the media playback to the underlying OS, does this mean following:
if I open 100 windows in QuickTime Player and the system can handle synchronous playback of those 100 movie clips, LC should be able to handle it as well? There should be no performance difference whatsoever if I play all those clips in Quicktime player or in LC? Or are there any Stack or Player-object properties that have an averse effect on playback performance in LC?
Thanks! BTW Great work you do here at the Forum!
Oliver
thanks for the quick response. This project is a sort of data visualisation, so the player objects will be positioned on a x/y axis according to different questions/options the user selects. Therefore it is difficult to create one big movie file beforehand. I also don't aim for smooth playback of 100 full HD clips, the clips are only 200x200 pixel, ca. 15 sec each, and I could live with something like 6-8 fps. So I believe it is doable, but it is on the edge, therefore I was looking for any "trick" to optimize the playback. How about layerMode or qtIdleRate or alwaysBuffer? Can I somehow "pre-load" the clips (since they are just about 2 MB each or in total ca. 2GB)? Is alwaysBuffer a property that works similar to some sort of a pre-load function? But than the dictionary says:
Setting a player's alwaysBuffer to true always increases memory usage, and may make movie playing more jerky.
When you say, LC only passes the media playback to the underlying OS, does this mean following:
if I open 100 windows in QuickTime Player and the system can handle synchronous playback of those 100 movie clips, LC should be able to handle it as well? There should be no performance difference whatsoever if I play all those clips in Quicktime player or in LC? Or are there any Stack or Player-object properties that have an averse effect on playback performance in LC?
Thanks! BTW Great work you do here at the Forum!
Oliver
Re: Improving playback performance - multiple player objects
Hi Oliver,
Player objects will always create some sort of overlay, which is always on top of all controls, so laymode does not apply here.
qtIdleRate:
Are you using LC >= 6.7x on a Mac?
Unless you explicitely:
set the dontuseqt to false
in your stack, LC now uses the new AVFoundation framework for playing media on OS X.
Apple has deprecated QuickTIme***, so this won't apply neither.
***The days of QuickTIme are definitively counted for the Mac and also for Windows.
E.g. when installing Apple's iTunes on Windows, it will NOT install QuickTime anymore!
alwaysbuffer:
the dictionary is correct!
With alwaysbuffer = true, the controller will not be functional, if that matters in your situation.
But I am no technical expert in this area
Best
Klaus
layermode:okk wrote:How about layerMode or qtIdleRate or alwaysBuffer? Can I somehow "pre-load" the clips (since they are just about 2 MB each or in total ca. 2GB)? Is alwaysBuffer a property that works similar to some sort of a pre-load function? But than the dictionary says:Setting a player's alwaysBuffer to true always increases memory usage, and may make movie playing more jerky.
Player objects will always create some sort of overlay, which is always on top of all controls, so laymode does not apply here.
qtIdleRate:
Are you using LC >= 6.7x on a Mac?
Unless you explicitely:
set the dontuseqt to false
in your stack, LC now uses the new AVFoundation framework for playing media on OS X.
Apple has deprecated QuickTIme***, so this won't apply neither.
***The days of QuickTIme are definitively counted for the Mac and also for Windows.
E.g. when installing Apple's iTunes on Windows, it will NOT install QuickTime anymore!
alwaysbuffer:
the dictionary is correct!
With alwaysbuffer = true, the controller will not be functional, if that matters in your situation.
No, you forget the overhead of communication LC <-> AVFoundation, so I think this will never be the same performance.okk wrote:When you say, LC only passes the media playback to the underlying OS, does this mean following:
if I open 100 windows in QuickTime Player and the system can handle synchronous playback of those 100 movie clips, LC should be able to handle it as well?
But I am no technical expert in this area

No, I'm afraid 100 player objects at the same time are just to much.okk wrote:Or are there any Stack or Player-object properties that have an averse effect on playback performance in LC?
Best
Klaus
Re: Improving playback performance - multiple player objects
Thanks for the further explanations. I use LC 7.01. so AV-Foundation framework is used. I have to find out more about it. I will do some testing when I get my hands on a mac pro with a fast ssd and see if there is any chance to get close to what I have in mind. My 2011 Macbook Pro managed around 20 player objects with my 200x200px mp4 files, so I have some hope. Best. oliver
PS: About Quicktime: I still remember vividly when I started to study back in the end of 1991 Quicktime was released and we played around with it. We were totally amazed when we could get a stamp-sized video playing back in our top of the line mac. times are changin.
PS: About Quicktime: I still remember vividly when I started to study back in the end of 1991 Quicktime was released and we played around with it. We were totally amazed when we could get a stamp-sized video playing back in our top of the line mac. times are changin.
Re: Improving playback performance - multiple player objects
Hi Oliver,
Wasn't "0.mov" the guy with the cigarette smoke?
Best
Klaus
yep, I was completely fascinated and "hooked" on moving images then!okk wrote:...PS: About Quicktime: I still remember vividly when I started to study back in the end of 1991 Quicktime was released and we played around with it. We were totally amazed when we could get a stamp-sized video playing back in our top of the line mac. times are changin.
Wasn't "0.mov" the guy with the cigarette smoke?

Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 256
- Joined: Sun May 27, 2007 8:19 pm
Re: Improving playback performance - multiple player objects
You could also try mergAV as a way to create players http://www.mergext.com
You have to create the controls to operate the players. I don't know if this is the case but since it is an external communicating directly with AVFoundation perhaps there would be a performance advantage.
Martin Koob
You have to create the controls to operate the players. I don't know if this is the case but since it is an external communicating directly with AVFoundation perhaps there would be a performance advantage.
Martin Koob
Re: Improving playback performance - multiple player objects
Hi Martin, thanks for the hint. On a first look I cannot see why mergAV would improve playback performance. The external adds functions and commands to work with media; perhaps in a similar way then the EnhancedQT external, but simple playback should be the same with or without the external. But I will look at it more careful. Best Regards. Oliver
-
- VIP Livecode Opensource Backer
- Posts: 256
- Joined: Sun May 27, 2007 8:19 pm
Re: Improving playback performance - multiple player objects
Hi I am not sure if it would improve performance but I thought it may be worth a try as there may be less overhead than there would be using the LiveCode player object. Again this is just an unproven hunch.
Martin
Martin
Re: Improving playback performance - multiple player objects
Just to report about our results: we managed to get up to 80 player objects playing almost synchronous on the late 2014 iMac (27" 5K i7, 8 GB RAM 4,0/M295X). We use OSX 10.10.5, LC 7.1. The players went out of sync by ca. 5 to 10 frames which was acceptable for our purpose. The video size was 150x150 pixels at a framerate of 12 fps and we had to use a ProRes 4444 codec to maintain transparency. When we went over the threshold of about 80 player-objects running at the same time motion got considerably more jerky. If perhaps maxing out the RAM at 32 GB can improve still perfromance, I don't know (yet). Best. Oliver
Re: Improving playback performance - multiple player objects
Congrats, consider me impressed! 

Re: Improving playback performance - multiple player objects
Hi,
from the very early days of Quicktime: the engineers made their own movie.
http://berndniggemann.on-rev.com/engine ... shower.mov
one of my all-time favorites.
especially "don't try this at home..."
Kind regards
Bernd
from the very early days of Quicktime: the engineers made their own movie.
http://berndniggemann.on-rev.com/engine ... shower.mov
one of my all-time favorites.
especially "don't try this at home..."
Kind regards
Bernd