News:

--

Main Menu

New feature.

Started by AviFan, August 17, 2023, 11:16:39 PM

Previous topic - Next topic

AviFan

Hello!

Please, add this simple features:

Please make .log file with time, when you join more files.

Example:
Video 1 - 00:00:00.000 Starts
Video 2 - 00:05:00.300
Video 3 - 00:10:00.500
Video 4 - 00:00:00 etc...
Video 5 - 00:00:00
Video 6 - 00:00:00

When you opened many files for joint - simply add right click
on the time line and "save timestamps as .log"...

And inside will be:
Video 1 - 00:00:00.000 Starts
Video 2 - 00:05:00.300
Video 3 - 00:10:00.500
etc...

Or check the picture:

eumagga0x2a

This (just without exporting as a text file, but generating text to copy and paste) should be possible more or less with existing tinyPy scripting capabilities.

Please clarify the use case / the purpose of the exercise, I don't see any.

eumagga0x2a

(I'll post a script later, looks quite straightforward for me)

eumagga0x2a

ed = Editor()
gui = Gui()

def timeToString(time):
    time += 499
    time /= 1000
    time = int(time)
    ms = time % 1000
    time = int(time / 1000)
    ss = time % 60
    time = int(time / 60)
    mm = time % 60
    hh = int(time / 60)
    plaintext = ""
    if hh < 10:
        plaintext += "0"
    plaintext += str(hh) + ":"
    if mm < 10:
        plaintext += "0"
    plaintext += str(mm) + ":"
    if ss < 10:
        plaintext += "0"
    plaintext += str(ss) + "."
    if ms < 100:
        plaintext += "0"
    if ms < 10:
        plaintext += "0"
    plaintext += str(ms)
    return plaintext

numberOfSegments = ed.nbSegments()
if not numberOfSegments:
    return 0

msg = ""
i = 0
linearTime = 0
while i < numberOfSegments:
    msg += "Segment " + str(i + 1)
    msg += " video " + str(ed.getRefIdxForSegment(i) + 1)
    msg += " start linear: " + timeToString(linearTime)
    linearTime += ed.getDurationForSegment(i)
    msg += " offset in ref: " + timeToString(ed.getTimeOffsetForSegment(i)) + "\n"
    i += 1

gui.displayInfo("Segment layout", msg)
return numberOfSegments

Save it as a text file with ".py" as extension instead of ".txt" and put it into the "custom" subfolder of the Avidemux profile directory (%appdata%\avidemux) for easy access. The only unpleasant side effect is that Avidemux always rewinds to the start of the video upon execution of a script. This is done for safety.

I do see benefits in making it easier to snapshot the current state of editing (not the "log" thing however).

AviFan

Thank you, working.
But please add "copy", because I can't copy this information!



I use this option, when I make the best moments of me - in some games.
But I will use for everything when I join videos. This option will be
helpful for many youtubers and not only to them...

PS: All screenshots will be auto deleted after 3 months.

eumagga0x2a

Quote from: AviFan on August 19, 2023, 01:16:00 AMBut please add "copy", because I can't copy this information!

Hmm, I cannot check at the moment – on macOS, the text in a QMessageBox::information, the type of dialog used by Avidemux for such popups, can be selected with the mouse, then copied to clipboard from the context menu of the selection (not by Command+C keyboard shortcut). If you add

print(msg + "\n")
on a new line after

gui.displayInfo("Segment layout", msg)
but before the line with

return numberOfSegments
you should be able to copy everything from the end of the Avidemux log file (the real one) %localappdata%\avidemux\admlog.txt which, on Windows, you can open in the default text editor via "Help" --> "Advanced" menu in Avidemux. If this works, you could simply delete the line with the gui.displayInfo() command responsible for the popup alltogether (in this case you don't need "gui = Gui()" either, of course) if you can do without visual feedback when running the script.

AviFan

My best moments are from 1-3 long, and I have many - 30-40 and more...
But the program only detect 14, all other are missing...
From my screenshot you see the limit:
Quote"Segment 14 video 14 start linear: 00:20:24.065 offset in ref: 00:0"

And when I copy the information is not in order like from the screen.
Segment 1 video 1 start linear: 00:00:00.000
Segment 2 video 2 start linear: 00:00:00.000
Segment 3 video 3 start linear: 00:00:00.000
etc...

When I copy they looks like this:
Quote---------------------------
Info
---------------------------
<big><b>Segment layout</b></big><br><br>Segment 1 video 1 start linear: 00:00:00.000 offset in ref: 00:00:00.000<br>Segment 2 video 2 start linear: 00:01:49.983 offset in ref: 00:00:00.000<br>Segment 3 video 3 start linear: 00:02:53.983 offset in ref: 00:00:00.000<br>Segment 4 video 4 start linear: 00:03:48.983 offset in ref: 00:00:00.000<br>Segment 5 video 5 start linear: 00:05:04.983 offset in ref: 00:00:00.000<br>Segment 6 video 6 start linear: 00:06:24.033 offset in ref: 00:00:00.000<br>Segment 7 video 7 start linear: 00:07:48.033 offset in ref: 00:00:00.000<br>Segment 8 video 8 start linear: 00:09:12.033 offset in ref: 00:00:00.000<br>Segment 9 video 9 start linear: 00:11:16.049 offset in ref: 00:00:00.000<br>Segment 10 video 10 start linear: 00:13:13.049 offset in ref: 00:00:00.000<br>Segment 11 video 11 start linear: 00:15:13.049 offset in ref: 00:00:00.000<br>Segment 12 video 12 start linear: 00:17:13.049 offset in ref: 00:00:00.000<br>Segment 13 video 13 start linear: 00:18:45.065 offset in ref: 00:00:00.000<br>Segment 14 video 14 start linear: 00:20:24.065 offset in ref: 00:0
---------------------------
OK 
---------------------------

Not in order...

eumagga0x2a

The maximum length of a message in a popup in Avidemux is limited to 1024 characters, formatting tags included.

If copy of text selection in the Windows version of QMessageBox includes formatting tags, this means that you should just use admlog.txt and use the popup (if at all) only to notify yourself that segment layout has been dumped to admlog.txt:

print(msg)
gui.displayInfo("Segment layout", "Human-readable list of segments has been written to Avidemux log file")
return numberOfSegments

Use

print(msg + "\n")
if you want an extra line break after the list of segments, else the simpler version above is sufficient.

AviFan

Possible to change this long and not needed information:

Segment 1 video 1 start linear: 00:00:00.000 offset in ref: 00:00:00.000
To this:
Just...

Video 1 - 00:00:00.000
Video 2 - 00:00:00.000
Video 3 - 00:00:00.000

When remove this parts
"Segment 1 video 1 start linear:"
"offset in ref: 00:00:00.000".

The message in the popup will looks better,
and that will increase the number of characters,
and will fit more videos. And the admlog.txt will be used only
when working with many short clips. For long clips around 10-20,
the popup message will be excellent!

 8)

AviFan

This time I add 18 long files 10-30 mins and the program
cut them to the 14 and inside the admlog.txt

[Script] Tinypy INFO - Segment 1 video 1 start linear: 00:00:00.000 offset in ref: 00:00:00.000
Segment 2 video 2 start linear: 00:13:36.246 offset in ref: 00:00:00.000
Segment 3 video 3 start linear: 00:20:54.227 offset in ref: 00:00:00.000
Segment 4 video 4 start linear: 00:45:08.704 offset in ref: 00:00:00.000
Segment 5 video 5 start linear: 01:02:28.166 offset in ref: 00:00:00.000
Segment 6 video 6 start linear: 01:22:46.861 offset in ref: 00:00:00.000
Segment 7 video 7 start linear: 01:48:36.371 offset in ref: 00:00:00.000
Segment 8 video 8 start linear: 02:13:09.065 offset in ref: 00:00:00.000
Segment 9 video 9 start linear: 02:24:10.962 offset in ref: 00:00:00.000
Segment 10 video 10 start linear: 02:44:01.191 offset in ref: 00:00:00.000
Segment 11 video 11 start linear: 03:07:49.969 offset in ref: 00:00:00.000
Segment 12 video 12 start linear: 03:31:01.946 offset in ref: 00:00:00.000
Segment 13 video 13 start linear: 03:52:06.957 offset in ref: 00:00:00.000
Segment 14 video 14 start linear: 04:06:28.336 offset in ref: 00:
[Script] Tinypy INFO -

Please make possible when you click on "Append", the "shift"
to work. Now is not possible to select all the files in one time.
You need to click 20 times if you need to open 20 files!
And please make, the files to be added in the same order
like the folder. To add from the first to to last. Not from
the last to the first.

sark

Quote from: AviFan on August 19, 2023, 04:42:55 PMPlease make possible when you click on "Append", the "shift"
to work. Now is not possible to select all the files in one time.
You need to click 20 times if you need to open 20 files!
And please make, the files to be added in the same order
like the folder. To add from the first to to last. Not from
the last to the first.

To import multiple files, open the directory they reside in, select all files, place your cursor on the first file, and drag them onto the Avidemux window.

Files must be in the correct order in the directory, and you must drag over with the cursor on the first file. If you drag from the third file, that will be the file that appears first in Avidemux, followed by four, then five, and so on.


AviFan

#11
Quote from: sark on August 19, 2023, 05:28:34 PM
Quote from: AviFan on August 19, 2023, 04:42:55 PMPlease make possible when you click on "Append", the "shift"
to work. Now is not possible to select all the files in one time.
You need to click 20 times if you need to open 20 files!
And please make, the files to be added in the same order
like the folder. To add from the first to to last. Not from
the last to the first.

To import multiple files, open the directory they reside in, select all files, place your cursor on the first file, and drag them onto the Avidemux window.

Files must be in the correct order in the directory, and you must drag over with the cursor on the first file. If you drag from the third file, that will be the file that appears first in Avidemux, followed by four, then five, and so on.



Thanks, this trick works!
You just save me 1 million clicks until the end of this year!

 ;D



eumagga0x2a

Quote from: AviFan on August 19, 2023, 04:42:55 PMThis time I add 18 long files 10-30 mins and the program cut them to the 14 and inside the admlog.txt

I bet you hasn't made the changes to the script I told you to do.

(Else I will look into length limit of print() output, sure).

AviFan

I change 10 times my settings, but with no results.
Same limit of 14 videos in the .txt file.

ed = Editor()
gui = Gui()

def timeToString(time):
    time += 499
    time /= 1000
    time = int(time)
    ms = time % 1000
    time = int(time / 1000)
    ss = time % 60
    time = int(time / 60)
    mm = time % 60
    hh = int(time / 60)
    plaintext = ""
    if hh < 10:
        plaintext += "0"
    plaintext += str(hh) + ":"
    if mm < 10:
        plaintext += "0"
    plaintext += str(mm) + ":"
    if ss < 10:
        plaintext += "0"
    plaintext += str(ss) + "."
    if ms < 100:
        plaintext += "0"
    if ms < 10:
        plaintext += "0"
    plaintext += str(ms)
    return plaintext

numberOfSegments = ed.nbSegments()
if not numberOfSegments:
    return 0

msg = ""
i = 0
linearTime = 0
while i < numberOfSegments:
    msg += "Segment " + str(i + 1)
    msg += " video " + str(ed.getRefIdxForSegment(i) + 1)
    msg += " start linear: " + timeToString(linearTime)
    linearTime += ed.getDurationForSegment(i)
    msg += " offset in ref: " + timeToString(ed.getTimeOffsetForSegment(i)) + "\n"
    i += 1

gui.displayInfo("Segment layout", msg)
print(msg + "\n")
gui.displayInfo("Segment layout", "Human-readable list of segments has been written to Avidemux log file")
gui.displayInfo("Segment layout", msg)
return numberOfSegments

eumagga0x2a

Please try the latest available 2.8.2 nightly first. I'll check the maximum length of print() output when able.