[Python] Optimal mp4 encoding for slideshows - How to encore programmatically mp4 file with...

Discussão em 'Python' iniciado por Stack, Março 28, 2025.

  1. Stack

    Stack Membro Participativo

    According to my understanding, it should be possible, to store only keyframes for slideshow, and set between them arbitrary length or break, for optimal size of file.

    How to do this in python or rust?

    I've tried few attempts with tooling so far, and now I stumbled upon wondering if I would have to make (preferably python or rust , eventually golang, zig, c++, etc) - which approach should I go:

    • use library that allows such low level manipulation of key frames metadata
    • no library will be good, so craft all encoding by hand or patch some library
    • generate mp4 with 30fps, changing image every 1/30 sec to take new keyframe, and then afterwards, open it with script and manipulate time between keyframes, (and add audio track at this or later stage?)

    Also I wonder if I could safely using ffmpeg (or similar) merge this with audio track and not damage such crafted piece, or if also adding audio track would have to be done in some program/script.

    Question is about programming, and I am sorry if previously it was not formulated clear enough, linking to previous one as it provides research context: MP4 file of arbitrary length with only one or two keyframes – possible? Tools?

    Continue reading...

Compartilhe esta Página