Author Topic: Script to write A+B markers to .EDL file  (Read 512 times)

ObvB

  • Newbie
  • *
  • Posts: 3
Script to write A+B markers to .EDL file
« on: July 28, 2019, 06:45:09 PM »
I would like to write A+B markers to a text output file, to be used as an .EDL file (https://en.wikipedia.org/wiki/Edit_decision_list).

If the current video is C:\videos\Filename.mkv, it would append to C:\videos\Filename.edl if it exists, or create the file if it does not.

Is this possible to write in a script? If so, is there some guide that will help me write such a script? (The only guides and examples I have seen only show how to write video output. I haven't seen anything that outputs to a text file)

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3381
Re: Script to write A+B markers to .EDL file
« Reply #1 on: July 31, 2019, 05:21:20 AM »
No work on this topic is planned. Providing exact information about what is expected as output might be helpful nevertheless, especially regarding the timing used by Avidemux i. e. no negative values possible and thus presence of B-frames in video resulting in the first displayed picture getting a non-zero PTS.

ObvB

  • Newbie
  • *
  • Posts: 3
Re: Script to write A+B markers to .EDL file
« Reply #2 on: August 01, 2019, 02:45:38 AM »
The output I wanted is the timestamps, as seen in the A: and B: textboxes on the lower right of the main screen (and now that I think of it, also the timestamps of the current cursor, and the first and last frame). I don't care if they are not on I-frames, negative or imaginary numbers ... I just don't want to go through the drudgery of reading them and re-keying them into another program.

What I am currently doing is creating an EDL file with comskip. It is very often very good at locating the correct cut points in a video, but it is not perfect. When I do need to correct the EDL file, I use avidemux. But then to edit the EDL it is tedious to read the numbers from the avidemux sceen, convert from hh:mm:ss.nnn to ssss.nnn and edit the .EDL file.

What I was hoping is that scripting within avidemux would have some rudimentary text file input/output functions. Even something as simple as QBasic's "LINE INPUT" and "PRINT".

(I'm then using ffmpeg to slice and dice using the EDL file. That's why I'm not concerned about cutting on non-I-frames and non-zero PTS.)

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3381
Re: Script to write A+B markers to .EDL file
« Reply #3 on: August 01, 2019, 03:26:55 AM »
The output I wanted is the timestamps, as seen in the A: and B: textboxes on the lower right of the main screen (and now that I think of it, also the timestamps of the current cursor, and the first and last frame).

The attributes Avidemux().markerA and Avidemux().markerB contain the raw value of the respective marker in microseconds.

Quote
I don't care if they are not on I-frames, negative or imaginary numbers ...

What is the difference from using random garbage values then? The timestamps would not match an exact frame in this case.

I don't think the built-in minimal python-like scripting can be extended, but saving the current state of editing to a file and parsing this file should be possible for anyone interested and capable.

The current PTS is not accessible this way, however. At least the formatted output as shown in the time display can be copied to the clipboard using Ctrl+Alt+C keyboard shortcut. It won't directly help here, but is better than nothing.

ObvB

  • Newbie
  • *
  • Posts: 3
Re: Script to write A+B markers to .EDL file
« Reply #4 on: August 01, 2019, 05:00:37 AM »
OK, thanks for your reply. I'll look at Save as Project and parsing the file.

And as far as timestamps possibly not matching exact frames.  I'm using the times in the .EDL file for the "-ss" and "-to" parameters for ffmpeg, and the numbers that I have manually copied from avidemux's time display work well enough for my purposes.