| Home | “This is how I extract my favorite clip from a video file. Using this method, internal subtitle tracks are automatically taken care of. And since no re-encoding of either the video track or the audio track is performed, the process is relatively fast and no quality is lost.” |

Free Download & Tutorial: How to Automatically Extract Your Favorite Movie Clip, including Internal Subtitles (with No Re-encoding)! (Version 8)

By Howard Charles Best, September 8, 2012

Major overhaul: January 7, 2015

(LLBest.com, )

On this web page:

A. Introduction
B. Assumptions
C. Get the Free Download
D. Main Features
E. The Demo
F. The Tutorial

A. Introduction

This is how I extract my favorite clip from a video file. Using this method, internal subtitle tracks are automatically taken care of. And since no re-encoding of either the video track or the audio track is performed, the process is relatively fast and no quality is lost.

The free download associated with this web page contains 3 files: 1) a .bat file containing a Perl script. 2) a .mkv (video) file used only for demonstration purposes, and 3) a .txt file also used only for demonstration purposes.

By the way, the video clip produced by the demo below was uploaded, including the subtitles (closed captions), to YouTube on the LLBest channel: Peter Gabriel - Solsbury Hill - 1 min clip (with Lyrics) 1080p.

B. Assumptions

This tutorial assumes the following:

1. That extensions for known file types are not hidden: a) Click Start. b) Click Computer. c) Click Organize. d) Click Folder and search options…. e) Click the View tab. f) Make sure that Hide extensions for known file types is unchecked. g) Click OK. h) Close the Computer window.

2. That you have installed Perl: a) Go to http://www.activestate.com/activeperl/downloads. b) Download the free version of ActivePerl for Windows. c) Install it, making sure that Add Perl to the PATH environment variable is checked (the default).

3. That each of the original video files is one of the following file types: .mp4, .mkv, .avi, .divx, .flv, .m2ts, .mov, .mpeg, .mpg, .VOB, or .wmv.

4. That each of the original video files has either 2, 3, or 4 tracks: track numbers 1 & 2 being the video and audio tracks (in either order), track number 3 being either an optional subtitle track or an optional chapters track, and track number 4 being an optional chapters track (if track number 3 is a subtitle track).

5. That you have installed the 64-bit version of MKVtoolnix so that "C:\Program Files\MKVtoolnix\mkvmerge.exe" works as a command line executable.

C. Get the Free Download

1. Download _SplitVideoFiles.zip (62.6 MB)

2. Unzip _SplitVideoFiles.zip to a folder named _SplitVideoFiles.

D. Main Features

1. There is no user interaction during run time to slow things down.

2. The video file to be split can optionally have an internal subtitle track.

3. Regardless of the format of the original video file, the split versions will always be in MKV format.

4. If the desired video clip is near the beginning of a very large video file, then much time may be saved by manually interrupting the processing by prematurely closing down the DOS window immediately after the desired video clip has been created. Doing so will not harm the desired video clip in any way.

5. Trying a different set of timings will not result in the video clips created during previous tries being deleted or overwritten.

6. The timings from previous runs may be "commented out," so that they remain as documentation.

E. The Demo

1. Navigate to the _SplitVideoFiles folder and see that it contains the following 3 files:

Screen dump #1 of the “_SplitVideoFiles” folder

2. Double-click the _SplitVideoFiles.bat file icon. If Perl and MKVtoolnix were installed correctly, you should see, for the next few seconds, lots of text being churned out within the DOS command line window. When it finally finishes, there should be 7 files instead of just 3:

Screen dump #2 of the “_SplitVideoFiles” folder

The LOG File (_SplitVideoFiles.log)

Done! And the desired extracted video clip is named Peter Gabriel - Solsbury Hill - 91 sec clip (1)-002.mkv. But how did the Perl script know what the desired start and end timings were? The answer is that they are contained in a .txt file with the same name as the video file:

The TXT File (Peter Gabriel - Solsbury Hill - 91 sec clip.txt)

3. Now change the .txt file as follows:

The modified TXT File (Peter Gabriel - Solsbury Hill - 91 sec clip.txt)

4. Again, double-click the _SplitVideoFiles.bat file icon. Now there should be 11 files instead of 7:

Screen dump #3 of the “_SplitVideoFiles” folder

The LOG File (_SplitVideoFiles.log)

Done! Now, instead of one 60 second video clip. we have two 30 second video clips: Peter Gabriel - Solsbury Hill - 91 sec clip (2)-002.mkv and Peter Gabriel - Solsbury Hill - 91 sec clip (2)-003.mkv! Please note that the first video clip, Peter Gabriel - Solsbury Hill - 91 sec clip (1)-002.mkv, is still there, and the timings which were use to create it are documented in the .txt file as a comment. (“#” in column one is the “comment indicator.” This says to the Perl script in the .bat file to “ignore this line.”)

F. The Tutorial

Now, after carefully studying the demo above, you are ready to extract your favorite clip from the video file of your choice:

1. Copy the _SplitVideoFiles.bat file to the same folder as the video file(s).

2. Play the video(s) using an advanced media player such as Media Player Classic - Home Cinema, noting down the starting and ending times of the clip(s) using the format: hh:mm:ss,hh:mm:ss, hh:mm:ss,hh:mm:ss, …. (Any number of spaces, before and/or after the commas, have no effect.)

3. For each video file, create a corresponding .txt file containing a list of the desire timings of the points at which the video is to be split, separated by commas.

4. Double-click the _SplitVideoFiles.bat file icon.

5. The rest of the process is automatic.

6. If the results are not acceptable, then “comment out” the previous sets of timings in the .txt files by adding a “#” in column one. Then add new sets of timings on separate lines. Then run _SplitVideoFiles.bat again. There is no need to delete the previously created video clips, and they will be NOT be overwritten! The nice thing about this system is that, if you decide to go back to using a previous version of a particular video clip, it’s still there, and the timings which were used to create it are documented as comments in the corresponding .txt file.

7. If a video clip contains subtitles and you want to be able to edit them or you plan to upload them to YouTube, you should first extract them to a separate .srt file that you can then edit as an ordinary text file and/or for uploading to YouTube. The program that I use for this purpose is called MKVExtractGUI. (YouTube simply ignores internal subtitle tracks.) If you are a perfectionist (like I tend to be), and want to also remove the subtitle track from the video file, then a Windows program called mkvmerge GUI (“C:\Program Files\MKVToolNix\mmg.exe”) may be used to do the job in fine style.

8. One thing that’s a little annoying about this method of extracting video clips is that the mkvmerge program seems to have a mind of it’s own when it comes to exactly where it splits the video. The actual time that it chooses could be approximately plus or minus 3 seconds of the time which you specified! Therefore, changing a timing by a second or two may not have any effect whatsoever! I usually change an unacceptable timing by 5 or even 10 seconds at a time! Therefore, a lot of trial and error may be necessary, and the end result, no matter how much time you spend experimenting, may not be ideal. But, in spite of this, this method is still very attractive because, since no re-encoding of either the audio or the video is done, it’s relatively fast, and no quality is lost.

TIP: Suppose, for example, there is 1 second of unwanted narration at the end of a clip extracted from a documentary. What I would do in such a case is to use mkvmerge GUI to delay the audio in the original video file by 1000 milliseconds, then extract the clip again, and then use mkvmerge GUI again, this time to re-sync the audio in the extracted clip by “delaying” it by -1000 milliseconds.


| Home | THIS WEB PAGE URL: http://LLBest.com/?P=7p |