Automating video preview generation with Python in Maya – random frames not rendering correctly

Automating video preview generation with Python in Maya – random frames not rendering correctly

edward_whitemore_uk
Observer Observer
422 Views
1 Reply
Message 1 of 2

Automating video preview generation with Python in Maya – random frames not rendering correctly

edward_whitemore_uk
Observer
Observer

Hi everyone,

I’m working on a small automation script in Maya that generates short video previews from longer clips.
The idea is to automatically pick key frames and export them as low-res previews for internal review.

Everything works fine in most cases, but sometimes the random frame selection skips a few timestamps, and the output preview ends up missing key shots.
I’m using Python to handle frame sampling and ffmpeg for encoding, but the skipped frame issue happens inconsistently — especially when multiple preview jobs are queued together.

Has anyone faced a similar issue or found a reliable way to handle batch preview exports in Maya or via the command line?
Would love to know how others handle render queue automation or frame consistency across multiple sequences.

Thanks!

Reply (1)
Message 2 of 2

artherpembroke
Community Visitor
Community Visitor

It sounds like the skipped frames are happening because Maya isn’t updating the scene properly before each capture, especially when multiple jobs overlap.

Try forcing a scene refresh before every frame capture using:
cmds.currentTime(frame, edit=True) followed by cmds.refresh(force=True).

Also, don’t run multiple preview jobs in parallel — Maya’s viewport isn’t thread-safe. Run them sequentially or through mayapy in batch mode for better stability.

Another reliable approach is to render all sampled frames first and then combine them later using ffmpeg, rather than encoding live during playback.

This workflow usually prevents skipped frames and keeps previews consistent.

0 Likes