Best method to create a video that plays frame by frame by default

Hi. We’ve developed an opencv-centric product inspection system that generates a lot of annotated images. Each image belongs to a batch. We currently store them as individual .png files.

We’re trying to think of a compact way to compile e.g. 35 result images from each batch into a single file that can be viewed offline, a frame at a time… served up on a website without a custom plugin, or emailed as an attachment and viewed with a generic video viewer.

Something that acts like a slideshow, that can easily be stopped and advanced with left and right arrows in Windows Media Player, etc.

Writing an mpeg using e.g. CV2::VideoWriter would meet the requirements for compactness and portability.

Question is… is there a way to mark up the file so that typical playback software renders it slowly, or a frame at a time, by default?

Failing that (or in addition), how about adding chapter markers (if there is such a thing) between the images so that the ‘next’ and ‘prev’ buttons on e.g. WMP advances a single frame?

Sorry to ask for something so basic, but I’m having trouble figuring out the terms of art, and my searches haven’t been fruitful so far.

Any suggestions appreciated…

set frame rate to 1 fps and hope that whatever player doesn’t drive its GUI loop based on the video frame rate, like some video players do… I once generated video files with minutes between frames. some video players hate that. it was just fine as an archival format though.

random access in the video shouldn’t be a problem if it’s intra-coded (MJPEG always, other formats conditionally). no need for chapter markers or subtitles, but you can do that if you like. I do that for some videos I generate to embed simple human-readable metadata for each frame (timestamp). it’s better than burning that into the picture.

you could use ffmpeg as a library directly. gives you more flexibility than plain opencv’s limited VideoWriter.

for python, there’s pyav, the only proper wrapper for ffmpeg’s libraries. all the other ffmpeg wrapper packages for python are junk.

if you’re going for MJPEG, make sure that common browsers support that. I’m not sure. it’s not all that modern… but that also means it should be universally supported. other formats are more common these days. all of them can be made to encode “intra-only”.

pay no mind to WMP. everyone plays videos either in the browser or in standalone programs like VLC, MPC-BE, … anyone in a corporate environment might be using the new outlook, which is nothing but a web app in a browser, except it doesn’t look like it’s running in a browser.

that entire question is specific to video file formats and compatibility. you could ask around in places that deal with video files/formats. some related terms you can chase up: ffmpeg, “Handbrake”, forum.videohelp.com, forum.doom9.org, probably a ton of reddits