Best practice to play HD Video

Hello,

I am working on a project that need to be playing 2 videos side by side (like a split screen). When I press a key,
both video starts playing simultaneously. Also, using other inputs the speed of each video will be adapted and changed on the fly. I am using ofQTKitPlayer to do it, based on the high performance osx video player example(something like that) at first. My problem is that as soon as I press this starting key, there is some delay before the videos load and then they are not very fluid. My application says that I run at not less than 70 - 90 fps but the videos are both very erratic.

I am currently using 1920x1080 (mov or mp4) HD video samples I found on internet. Right now they are < 100 Mb but in the near future I would like to play much bigger video files.

I was reading on the forum recently about threading video player tasks to improve performance and I gave a try to this addon: https://github.com/gameoverhack/ofxThreadedVideo. It is based on ofVideoPlayer, seems to work fine with one video but still it is not that fluid and there are plenty of pauses and frames jumped.

So I am wondering what would be the correct/best approach for such task? If it is a matter of video format, which should be avoided absolutely?

Thanks!

I ran into one of these recently.

Not sure if this is the way out but worked for me.

We are using mov format and we set the compression to h264 codec. There is also an export setting that we figured out. I dont have it with me now, my friend has it. ll share the details once I get office.

Hope it works for you.

Hi ofSMF,

I gave it a try during the weekend and it seems to be better indeed: both videos plays smoothly. But there are flickering quite a bit. I will investigate this flickering problem but at least I now have videos that plays fine.

Thanks!

I was able to get some pretty impressive framerates and smooth playback for multiple HD videos. Some of the optimisations were simple, working from an SSD really changed a lot. I dont know fi you are on OSX but if so check out the high performance video player. You get some initialisation options like decode texture only and asynchronous scrubbing disabled. With the right codec, a fast SSD and these options I had no trouble playing multiple HD videos smoothly. However this relies on quicktime loading the videos, which is fine if you only want to load videos once. If you need to change videos it is better to do it in another thread as I got some crazy results letting QT take care of it when it is busy. This was a little more difficult but again by tweaking codecs and playing around it was ok.

Hi Fresla,

Yes having SSD drive helps a lot I can believe but unfortunately I don’t have one.

I am using already the high performance video player from the examples but not understand what you mean by “asynchronous scrubbing”: is this the same as in the example

  
fingerMovie.setSynchronousSeeking(false);  

Cheers!

Yes, this is what I meant, sorry it was from memory fingerMovie.setSynchronousSeeking(false);

Maybe someone else has some tricks- I could not get it to work that well without the SSD, but I was going for more than 2 movies. What codec are you using?

When you say they are side by side, does that mean you are using an output that has 3840x1080 resolution?

As ofSMF pointed out, I am using h264 as codec.

For this project where I have 2 videos side by side, basically the screen size is 1920x1080 and both video are cut in half, vertically, in order to fit one next to the other.
I moved to using ofxThreadedVideo as it is with this that I got the best results. But I cannot used the QTKitPlayer tricks with this though.

Now for another project, I need to play at the same time 4 HD videos with alphas.
So I cannot use the ofxThreadedVideo addon as it is based on ofVideoPlayer. I will then try this setSynchronousSeeking trick. If it is not working, I guess I would lower the resolution of the videos until I have fluid results.

Cheers!

I tried with setSynchronousSeeking(false) but I didn’t see improvements in my application unfortunately.

Next one on the list is to try playing those video using ofThread. Let’s see how this goes :slight_smile: