How to find and select first keyframe with Python?

Started by Lebenita, December 20, 2012, 07:37:05 AM

Previous topic - Next topic

Lebenita

In my quest to batch-process the video crop of recent years, avidemux regularly crashes with a message that seems to indicate it takes exception at files that don't start with a keyframe (beats me how those files ever came into being in the first place).

Do you know of a way to find the first keyframe in Tinypy and adjust the A marker accordingly?
BTW, do you have to set the B marker as well if you set the A marker or do you only have to set it if it should be different from the end of file?

Jan Gruuthuse

Can't answer for find the first keyframe perhaps you find answer in: Avidemux 2.6 Scripting Reference on what is available: found in Maine Menu (text): Help: QTscript Reference?
Regarding B marker: if you need to attach to this video clip: Cut must also be made on Keyframe: so you need to set [ B] on last keyframe you make cut or verify end of clip is?

Lebenita

Quote from: Jan Gruuthuse on December 20, 2012, 09:21:39 AM
Avidemux 2.6 Scripting Reference on what is available: found in Maine Menu (text): Help: QTscript Reference?
I have briefly looked at it, but not having seen any mention of Tinypy, I didn't look further as there seem to be significant differences between the object models of the various scripting engines (at least between JS and PY).

And while the class reference is in the "QtScript" folder, the text in it consistently refers to the "ECMA scripting engine". Also, the "Editor" that is supposed to "expose most of the video and audio editing functionality" does not even seem to be available in Python, where it seems to have been supplanted by Avidemux.

It would be great if we could get some guidance (preferably in the wiki, which is still stuck with pre-2.6 information) on how to get scripting to work in 2.6.

mean

You have 2 engines :
The QT one which is close to javascript/ecmascript
The tinypy one which is a small / limited implmentation of python

The avidemux specific bindings are available through the tinypyshell and saving a project will use tinypy language, so looking at a project script will help
In you can use the tinyPy shell to interactively test your programs
Type them + CTRL/Enter and they will be executed

If you have specific questions ....

Lebenita

Thanks for the clarification re. engines.

As for specific questions, as stated in the introductory post, I'm looking to find the first keyframe in a file. From the reference, it looks like "currentFrameProperties" might be the ticket, but I haven't found a single py example using it, and in the shell, the function doesn't seem to exist in either Editor or Avidemux instances.

mean

At the moment there is no navigation functions in the bindings
Can be added though

Lebenita

That would be great!

Generally speaking, it seems that the Tinypy functionality doesn't yet expose a significant part of Avidemux functionality, is that correct? Do you plan to extend it to cover all or most of what Avidemux offers?

Is JS or QT in 2.6 more complete? Could I use currentFrameProperties() there? (Assuming I get JS to run on 2.6 at all, something I haven't managed so far as all objects like Avidemux, Directory etc. are not recognized).