News:

--

Main Menu

Hotkey for "Next Black Frame"

Started by shmorgasbored773, November 19, 2023, 03:42:41 PM

Previous topic - Next topic

shmorgasbored773

Hello,

I'm new to the forum, but I have been using Avidemux for some time.

I use it every week to trim commercials from OTA recordings before I add the shows to my Plex server.

I constantly use the "next black frame" button, but there is no corresponding hotkey. Of course, "Next Black Frame" doesn't always work for trimming commercials, but it works 90% of the time and I use it a lot.

Is there a way to add this as a hotkey? I spent some time searching the forums, but I didn't find anything about adding this particular hotkey.

I've considered compiling my own version of Avidemux just to have a hotkey for this. Would this be possible? I'd hate to go to the trouble of attempting to compile the program (for windows) only to find out it didn't work.

Thanks in advance for any info.

eumagga0x2a

There is a pull request by szlldm adding keyboard shortcuts to custom scripts, waiting for being processed. Once it gets merged, you will get the infrastructure to call any scriptable commands using keyboard shortcuts.

Building Avidemux from source yourself is always the recommended way to obtain binaries, please have a look at the how-to: https://github.com/mean00/avidemux2/blob/master/cross-compiling.txt

shmorgasbored773

I'll keep an eye out for the "custom scripts" option being added.

And I'll look into that link about building my own from source.

Thanks for the quick response.

butterw

Quote from: eumagga0x2a on November 19, 2023, 05:34:18 PMThere is a pull request by szlldm adding keyboard shortcuts to custom scripts, waiting for being processed. Once it gets merged, you will get the infrastructure to call any scriptable commands using keyboard shortcuts.

+1 to adding keyboard shortcuts for custom scripts.

eumagga0x2a

Quote from: shmorgasbored773 on November 19, 2023, 10:44:11 PMI'll keep an eye out for the "custom scripts" option being added.

And I'll look into that link about building my own from source.

You might have a direct insentive to put your intention into practice as the mentioned above pull request has been merged and seek to black frames added to Avidemux Python-like scripting.

Seek to next black frame:

#PY
#
adm = Avidemux()
if not adm.isFileOpen():
    return
adm.seekBlackFrame(1)

Seek to previous black frame:

#PY
#
adm = Avidemux()
if not adm.isFileOpen():
    return
adm.seekBlackFrame(-1)

Some refinements are still missing: as of now, calling custom scripts pollutes the list of recent scripts.

eumagga0x2a


Geo_log

#6
Quote from: eumagga0x2a on November 26, 2023, 11:29:05 PMSeek to next black frame:
#PY
#
adm = Avidemux()
if not adm.isFileOpen():
    return
adm.seekBlackFrame(1)
I need not only find the black frame, but I need to remove it. So I modified this tinyPy script:#PY
#
adm = Avidemux(); ed = Editor()
if not adm.isFileOpen(): return
#
PrevPts = ed.getCurrentPts()
adm.seekBlackFrame(1)
BlackPts = ed.getCurrentPts()
if BlackPts != PrevPts:
    adm.markerA = BlackPts
    adm.seekFrame(1)
    adm.markerB = ed.getCurrentPts()
else: raise("Run out of BlackFrames")
but after executing this custom script the selection between markers [A and [B is not active. I need to press "<-" to make it active, and then click Delete (or Ctrl+X) to remove the black frame. How to make the selection active inside the script? By the way, adding the command "adm.seekBlackFrame(-1)" doesn't  help.
And the second question - how to "click Delete" inside the script?

eumagga0x2a

Quote from: Geo_log on January 04, 2024, 12:52:12 PMI need not only find the black frame, but I need to remove it.

What is the purpose of deleting just a single picture? Do you actually try to select for eventual deletion a stretch of black pictures?

Additionally, you cannot rely on the function to seek to black frames to do its job. It will miss black frames when e.g. a bright sender logo is shown. It will produce false positives in sufficiently dark non-black pictures. Visual control is absolutely required.

Quote from: Geo_log on January 04, 2024, 12:52:12 PMafter executing this custom script the selection between markers [A and [B is not active.

Should be fixed now, please try a future nightly.

Quote from: Geo_log on January 04, 2024, 12:52:12 PMhow to "click Delete" inside the script?

The only way is to create the needed segment layout directly.