This project has moved and is read-only. For the latest updates, please go here.

Friendly EDL Edit Applicator Script- Easily strip EDL edits out of your MKV files with one drag and drop

Jul 7, 2015 at 6:54 PM
Edited Jul 7, 2015 at 10:52 PM
Friendly EDL Edit Applicator Script

What is it?
Friendly EDL Edit Applicator is a batch script that allows you to drag and drop your EDL file in order to strip your the sections definied in the EDL file saving space and without losing compression.

Features
-Quickly apply EDL file to your recordings
-Simple Drag and Drop Application
-Saves space over simply using the EDL file to auto-skip playback.
-Fast (does not re-encode)
-Retains Quality (does not re-encode)
-Once you apply your EDL file to your recording, you no longer need to keep the original recording and the EDL file if you don't wish to.
-Will not delete your files, will only create a new file with a modified name.
-Supports x265 / HEVC encoded files (assuming ffmpeg and mkvmerge are up to date)

What are the requirements?
You need to have ffmpeg and mkvtoolnix's mkvmerge applications on your computer.
The paths to these programs will need to be defined in the script before you start. The script will warn if it does not know where to find these applications. see www.ffmpeg.org and www.bunkus.org/videotools/mkvtoolnix/

Why did you build this script?
As I have played around with MCEBuddy, I have opted to not have MCE buddy automatically make the comskip edits because it is rarely 100% accurate, and I did not like loosing parts of my shows or leaving bits of commercials in them either. So I let it generate the EDL file, then I manually review and make changes the EDL file to make sure it is correct. Once you have the EDL file defined there are lots of applications that can make use of it, but there are lots that cannot. I did not find a good way to edit the edl sections out (Especially since I'm encoding to HEVC) Thus I created this script to help me strip commercials out quickly.

How fast does it work?
Because the script never re-encodes, it is incredibly fast, it can strip out the defined EDL sections in just a few seconds.

What are the limitations?
Currently I have only tested on MKV files, however I believe MP4 files should also work. Regardless, your output will end up being a MKV file.
-Currently only supports a maximum of 6 lines of edits in an EDL file. (you can easily modify the script to support more)

How do I get started?
-Grab the script below and paste it into a notepad style editor and save as FriendlyEDLEdit.bat
-Define your paths to ffmpeg and mkvtoolnix in the ::EDITABLE VARIABLES section.
-Drag and drop your EDLs onto the .bat file to process.


What Else?
If you have any questions or comments, or ideas for additional features, I would love to get feedback.
Marked as answer by rboy1 on 10/15/2015 at 2:47 AM
Jul 7, 2015 at 6:54 PM
Edited Jul 10, 2015 at 10:47 PM
I had originally intended to just post the script in this post, however it would not fit within the 10,000 character limitations of the post...
you may download it using the following links:
(after downloading, rename it as a .bat file instead of .txt)

v1.1
www.exoid.com/friendlyedl/friendlyedledit_v1.1.txt
-added support for EDL cut using "0" or "0.000" instead of "0.00"

v1.0
www.exoid.com/friendlyedl/friendlyedledit.txt
Jul 7, 2015 at 8:30 PM
interesting script. Why not just feed the EDL file back to MCEBuddy after verifying it?
Not really sure how this is different from running comskip, using MCEBuddy Custom Cuts to verify the EDL cuts and letting MCEBuddy take it from there?

Jul 7, 2015 at 10:52 PM
Edited Jul 7, 2015 at 11:55 PM
rboy1 wrote:
interesting script. Why not just feed the EDL file back to MCEBuddy after verifying it? Not really sure how this is different from running comskip, using MCEBuddy Custom Cuts to verify the EDL cuts and letting MCEBuddy take it from there?
Custom Cuts doesn't seem to like reading my HEVC encoded files, and I can't spare the space storing large .ts or .wtv files until I get around to checking them out and encoding them down. I can apply a correct EDL at my leisure while still dropping recorded TV into its final destination that is readily accessible in the final folder (In my case, a plex monitored TV Shows Folder)

This does bring up a good clarification point though... this script is very much meant for post encoded files rather than large pre-mcebuddy processed files.
Jul 8, 2015 at 12:12 AM
ahh makes sense. BTW Custom Cuts uses Windows Directshow Filters. Windows doesn't support HVEC yet hence Custom Cuts doesn't show it.
If you install a codec that's compatible with directshow it'll start working.

Jul 8, 2015 at 2:56 PM
rboy1 wrote:
ahh makes sense. BTW Custom Cuts uses Windows Directshow Filters. Windows doesn't support HVEC yet hence Custom Cuts doesn't show it. If you install a codec that's compatible with directshow it'll start working.
Thats a great tip, I'm going to try that out, as previewing and defining the edl in that interface would be much nicer than the way I'm writing down the timecodes now. Thanks
Jul 10, 2015 at 1:22 AM
If there is no encoding this must mean that you are only cutting on I frames, so I would expect accuracy will be an issue?
Jul 10, 2015 at 2:09 PM
True, not just for directshow but even within mcebuddy the cutting is always done on iframes to maintain the video integrity. Cutting on a non I frame leads to video artifacts and hence we decided to switch to iframe boundaries about a year ago.

Jul 10, 2015 at 8:45 PM
I can't seem to get the script to work. I keep getting this error:

Error: The file 'C:\Users\David\Desktop\The Big Bang Theory\Season 08\S08E18-The Leftover Thermalization.clip1.mkv' could not be opened for reading: open file error.

I see that the script creates

C:\Users\David\Desktop\The Big Bang Theory\Season 08\S08E18-The Leftover Thermalization.clip2.mkv
C:\Users\David\Desktop\The Big Bang Theory\Season 08\S08E18-The Leftover Thermalization.clip3.mkv

But no

C:\Users\David\Desktop\The Big Bang Theory\Season 08\S08E18-The Leftover Thermalization.clip1.mkv

Any ideas cbutters?
Jul 10, 2015 at 8:59 PM
Edited Jul 10, 2015 at 9:22 PM
rx7guy wrote:
Any ideas cbutters?
Can you post the content of your EDL file? The script accounts for EDLs starting with 0.00 to not create the first clip, does your EDL file perhaps say "0" instead of "0.00" on the first edit line? I could see that causing your issue.


Update added support for EDL with "0" in v1.1 (see second post)
Jul 10, 2015 at 9:44 PM
Edited Jul 10, 2015 at 9:46 PM
PoBear wrote:
If there is no encoding this must mean that you are only cutting on I frames, so I would expect accuracy will be an issue?
yes you are right. the default method for ffmpeg (which judging by the config files that mcebuddy uses to do the initial encode) does not use a -g modifier, which means it would use the default 250 frames between every i frame. (~8 seconds at 29.97fps) I don't know if ffmpeg drops i frames every 8 seconds or if it smartly drops extra i frames if it detects scene changes. I haven't really noticed any issues on my files when cutting right on the commercial scene change... but maybe rboy1 could speak more to how i frames are used... if they happen on scene changes, or just uniform at every 250th frame, if it does it smart; I think we are still golden for our usage model of cutting commercials.
Jul 10, 2015 at 10:17 PM
cbutters wrote:
rx7guy wrote:
Any ideas cbutters?
Can you post the content of your EDL file? The script accounts for EDLs starting with 0.00 to not create the first clip, does your EDL file perhaps say "0" instead of "0.00" on the first edit line? I could see that causing your issue.


Update added support for EDL with "0" in v1.1 (see second post)
EDL Content:

0.000 184.148 0
327.599 519.598 0

V 1.1 doesn't work either. :(
Jul 10, 2015 at 10:46 PM
Edited Jul 10, 2015 at 10:47 PM
rx7guy wrote:
V 1.1 doesn't work either. :(
Weird, I've never seen any of my edl files with three decimal places.

I just updated it for you..... hit F5 to refresh it... It should work now.
Jul 10, 2015 at 11:15 PM
Edited Jul 10, 2015 at 11:16 PM
cbutters wrote:
rx7guy wrote:
V 1.1 doesn't work either. :(
Weird, I've never seen any of my edl files with three decimal places.

I just updated it for you..... hit F5 to refresh it... It should work now.
Still no go. I don't know if this matters or not but it looks as if the script creates the first clip as clip 1 but it shows up as clip 2 in the folder. Then at the end it looks for clip 1 but there is no clip 1 in the folder. I hope that makes sense.

Edit: Also, I changed the first cut to start later and that has had no success either.
Jul 11, 2015 at 1:27 AM
An I-frame (or key frame) holds the whole video picture, the other frames in a video (P and B) only hold partial information, effectively applying their changes as a series of layers on top of the full picture. Depending on the encoder used when the original video was produced and how it has been set up, an I-frame will be cut at specific intervals or because sufficient information has changed to force an early I-frame, this might happen for example in an action sequence.

I've been editing videos for well over 10 years, I would say that at best only 50% of the cuts I make are able to use an I-frame as a cut point. It most likely happens where there is cut to black or a static channel logo, but even then it does not always work, typically fade ins or out will not be on an I-frame. You can also get caught out where the video is black but the audio is still running.

Cutting out is not usually an issue as the encoder will be able to use the previous I-frame and the subsequent frames, the problem is cutting back in, if you are not doing so on an I-frame then a standard encode does not have the information to create a full picture so depending on how far back the previous one is you might get a 99% picture with limited artifacts to nothing but artificats until the next I-frame is read.

There is no way around this with what I will call a serial encoder such as FFMPEG. It is possible to overcome the problem by using software that supports "smart rendering" where the s/w creates a new start I-frame by using information inside the cut and then re-renders the video until it reaches the next I-frame in the video stream, but there are no encoders that do this.

I know of only one non-commercial package that does smart rendering and that's VirtualDub, but it was originally written when the world was MPEG-1/2 and DIVX/XVID and as a consequence only supports AVI containers, which have inherent problems with aspect ratios.

The bottom line is that it depends on how OCD you are, I'm high maintenance and cut on specific frames, I can't tolerate even a single frame of logo or commercial and will re-edit if I find one, if you are not bothered about losing up to 5 seconds of video on every cut then I-frames are fine.
Jul 11, 2015 at 6:06 AM
rx7guy wrote:
cbutters wrote:
rx7guy wrote:
V 1.1 doesn't work either. :(
Weird, I've never seen any of my edl files with three decimal places.

I just updated it for you..... hit F5 to refresh it... It should work now.
Still no go. I don't know if this matters or not but it looks as if the script creates the first clip as clip 1 but it shows up as clip 2 in the folder. Then at the end it looks for clip 1 but there is no clip 1 in the folder. I hope that makes sense.

Edit: Also, I changed the first cut to start later and that has had no success either.
I just tried applying your EDL you posted to one of my random videos, it worked fine, double-check that the version you grabbed is up to date (i made some minor edits on the 1.1 version at one point to accomadate the way your EDL is formatted. Make sure your .bat file has lines that look like this in the corresponding section:


:CHECK FOR FIRST EDIT STARTING AT ZERO
IF [%cut1start%]==[0] SET linezero=1
IF [%cut1start%]==[0.00] SET linezero=1
IF [%cut1start%]==[0.000] SET linezero=1


If you have the right version you will see those lines somewhere in the script, and it should work.