Whenever ofVideoPlayer::setPosition() is called it causes a big jump in CPU load and fps drops. (I’m using h264)
This is fine with just one video (fps will go from 160 to 80 for a moment), but I’m doing this with two and sometimes up to four videos simultaneously with additive blending, and the result is pretty drastic.
I’ve been considering using jpeg sequences with ofxTurboJpeg for everything instead, but the drawback of this is that it continuously tanks the fps while recording (I’m recording the video live). Recording two videos live with ofxFFmpegRecorder (@NickHardeman branch) is easier on the fps during recording but very hard on the CPU (+ the aforementioned setPosition() problem at playback) so jpeg sequences might be the lesser of two evils, unless anyone has another idea…
I would consider some other codec for random access, as I use macOS I usually go prores, or even photo jpeg (has a nice random access)
in h264 the usual settings make one keyframe (a full image with all the colors) per second, so there are 29 more frames with only the differences (datamosh is a difference without the right keyframe) so if you happen to jump to frame 29 after a keyframe the computer has to calculate everything in the last 29 frames to give you the final image.
Hey, thank you. I’m on Windows but can still use prores and it is indeed faster than h264. fps still drops a bit when calling setPosition(), but it was straight up freezing momentarily with h264, which it doesn’t do with prores.
I didn’t see photo jpeg as a codec option in ffmpeg.
Would mjpeg record/playback faster than prores? It seems you need to modify some oF code to get it working properly in Windows. It records strangely and crashes oF when I try to play it back as is.
ProRes422 or 4444 is my favorite choice of codec now, great quality, usually fast enough for some random access and my machine has hardware decoding which helps.
For totally random access, let’s say if you want a video to respond to an audio input peak and jump playhead all around I would use PhotoJpeg first choice.
ofxHapPlayer and Hap codec works real fast too if you don’t need audio playback or alpha channel