Jump to content

Splitting video files into two parts A and B


Russ Croucher

Recommended Posts

I'm working on a procedure that uses video pad to split movie files into 2 pieces.  The reason for this is some Blu-ray players do not accept video files larger than 4 gigs because they must be formatted using the exFAT or NTFS file system.  They only support FAT32, which is limited to 4 gigs.  So if the file is larger than the 4 GB I split it in the 2 pieces that contain an A and B.

So my goal is to put two hours in the A file and the rest into the B file.  I want to use this in an automated procedure which does not use a mouse.  I can do all this in something like C# but I like the flexibility that video pad offers a lot of different formats.  So I'm trying to find ways to do everything with keystrokes since I'm stuffing keys into the process.  I realize in this process that the program flushes the keyboard buffer went is doing things.  So I know I have to wait until the program is idle before I can stuff it the appropriate keys.

There are keystrokes in the help procedure which I have used but it looks like there are some items that cannot be switched with keys and require the mouse.  Maybe you guys can help me and maybe there are keys I can use.

Example I use a shift-G to enter a cursor position in the timeline.  I would then like to do and "L" to split the video.  In story mode it would go from a single story to duel.  So my goal would be to write the 1st 2 hours to one file in the 2nd 2 hours to another file.  But I don't know how to select which file to use with just the keyboard.  With the mouse I could delete 1 side cook,  wright the file, use the control-Z(undo) then delete the other side to write that file.  I'm having trouble trying to figure out how to do that with all keyboard actions so I can put it in the procedure.

Is there any way to tell what box video pad is in in which keys work with that box?  They do tell you and that help what keys are working what box they don't tell you what box is in.  I know I can use the mouse and select a box but I want to do this with the full-blown procedure.

Example when you select the final output window the shift -G works but if you hit the tab button enough times you will get to the cursor box where the shift-G is just entering the G uppercase.  This is not what I wanted.

Link to comment
Share on other sites

That sounds like a pretty good plan.  I started with video pad way before we even had sequences and never really investigated how they worked.  What I want to do is set up one sequence to just read the file in and write the 1st 2 hours and the 2nd sequence to take the rest of the file 2 hours on.  Typically my procedure batch files would put everything to a standard input file like "I .mp4".  Then I would be looking for 2 files to be output that can be altered on my behalf like "A.mp4" and "B.mp4".  Does this sound plausible?

I try to keep my processes generic enough so you guys can make newer improvements it won't cause me problems.  I guess I need to look at the video tutorial on how sequences work.  You have such a video?

Link to comment
Share on other sites

Haven't run across a detailed sequences tutorial.  Here's a single-sequence macro approach...

Place clip on timeline

  • Position the mouse pointer (not the cursor) on the timeline ribbon at the halfway point
  • Hold down <shift> and click the top of the cursor
  • Right-click the blue area and click CREATE for seg 1
  • Hold down <shift> and click the timeline ribbon at end of the project
  • Right-click the blue area and click CREATE for seg 2

Link to comment
Share on other sites

Choose Export Selected Region.  Then the usual export box will appear as shown in the above video.  At the bottom of that box...

image.png     The program will create sequence 1.  After selecting part two in the manner shown, it will create sequence 2.

Link to comment
Share on other sites

Okay I have a project file, using sequences that works.  However, the input file must be longer than any of the data files that will be used.  This is like all my other examples that need a dummy input file of the longest length I would never use.  Example, if I'm going to split a 6 hour file into 2 pieces the dummy file must be 6 hours in length.  Video pad will reduce the input file to the smaller amount but it will not go larger.  So the 1st sequence is to output the 1st 2 hours in sequence 1 and the remaining file length in sequence 2.

I did have a little trouble using your example above.  So what I ended up doing was creating one sequence to load just 1st 2 hours and clipping the rest of the file in the timeline.  Then creating a sequence to load only 2 hours to the end.  My question is is there any way to output all sequences with a keycode (not a menu choice) or do I have to save file and then scroll down 8 times to get to the output all sequences which would make be dependent if you ever change your menu.

Link to comment
Share on other sites

Don't follow a need for 'dummy' files.  Apparently that's related to your automation procedure.

In VP all that's needed is to import the full file and follow one of the above methods above to split and export.  A six-hour file, however, would be pushing things.

There apparently isn't a shortcut key for Export All Sequences though <ctrl-B> works for a single sequence.

Request it by clicking the ? at the top-right of the VP window and making a suggestion.

Link to comment
Share on other sites

The dummy file problem I'm talking about is a situation that I figured out several years ago with video pad that if you store a smaller file name them what is actually used.  Video pad will use that length it will never expand on the new file.  Remember the I .mp4 I use as a dummy name and if I were to put a longer file than what video pad is expecting it truncates to the link that it was stored.  The capture card I use actually give me the video.  2 frames later than the audio that's received with debut.  So therefore I must delay the audio by exactly 60 ms to line up perfectly with the video.  If that delay file is shorter than any input file I present to video pad it will truncate to that length.  So I have a dummy file that is 6 hours in length that delays the audio from the video for alignment.  Any file that is shorter than this length will be handled by video pad just fine.  Apparently this particular problem that I'm planing is also true with the splitting the file.

I don't find this is a problem because when I load my project file I use the dummy input that splits the file.  Example, if I have a 6 hour file, the 1st segment will store 2 hours and the 2nd segment will store 4 hours.  If I have it an input file of 4 hours then the 1st will store 2 hours and the 2nd will store only 2 hours.  If I save that project name it will only allow the input file up to 4 hours in length.  So if I then give it a 6 hour file it will put 2 hours in the 1st file and only 2 hours in the 2nd file truncating the last 2 hours of the 6.  I have verified this with my procedure using only file save with video pad.  I'm okay with that as I use it with my other procedures.  Now do you understand?

I'm wondering if it would be easier to select the different sequences then trying to do.  Export all sequences without a shortcut key.  I could walk through the sequences and dual control be for each sequence.  That might be an easier solution.  What you think?

You have a shortcut key to go to a particular sequence window?  What about selected different between sequence 1 and sequence 2.

Link to comment
Share on other sites

Seems that a macro could be used to achieve your goal.

Forgive my ignorance, but it's still unclear why a dummy file is required.  By "store", assume you mean ADD to the bin, which will not change file duration.

File names should be irrelevant.  If a longer file of the same name is added to a bin that already has a file of that name the new one will have a (1).  The duration of the files will not change.  It's the same if the file is dropped onto the timeline, without trimming, or duplicated it in another sequence.

Saving the project does not change file durations.  Remember, clicking SAVE overwrites the prior VPJ.  Click the chevron at the right of the button and SAVE PROJECT AS, giving it a unique # or name.

Exporting will output the entirety of a sequence unless it's been intentionally truncated.

If there's a sync issue, audio can be added to another track, then bumped slightly.  Then the original track can be muted.  The original audio can even be saved as a new WAV file, then added as the to-be-synched second audio track.  Right-click the audio clip and Save Audio Clip as New File.

As for shortcut keys, file a suggestion...  https://www.nch.com.au/suggestions/index.html?software=VideoPad

Link to comment
Share on other sites

Maybe I have stumble across a bug that I've never reported.  Try it yourself.  Take a project file drop it into video pad, do anything you want to it, save the file(VPJ), replace that file with a larger file of longer length.  When you bring up video pad and execute the save button it will only save up to the truncated amount and truncate the rest of the file.  I've seen this for many years so once the file is loaded any longer length is truncated when the video pad project VPJ is saved.  I found this to be also true when I would spoof video pad when I would do my 4K drone videos and I condensed everything to a small resolution for editing.  It only works if the file is shorter length than the original file.  I don't know why or care.  If this is a bug let me know.  Maybe I have stumble across something and worked around it in.  A different way.

As far as the audio yes delaying the audio file worked as a single channel in video pad.  Again however, the final file must be shorter than the VPJ when it was created and saved.  Again, I don't know why.  Maybe I have stumble across something and didn't realize it.  Try it let me know.

I know when I'm creating my 4K videos of my drone I converted everything to HD with handbrake before I even start my operations.  Then I'm able to edit everything as video captions, music, etc. etc. which I have learned here and then after I'm done with all the work I switch back to the 4K version for the final rendering by just changing the files in the folder.  But again the length of all the files must be shorter than the original length because of the VPJ.  Again, I don't care because the same file but small resolution.  Let me know.

-0-

I would love to find out more information about writing macros inside video pad which I have never done.  People tend to write software with what they know.  I also am not limited by one particular program as I use anything in my basket of programs to do a particular operation.  Do you have information you could forward me on writing macros inside video pad?  I know that you have the ability to do some batch file stuff with video filters but don't do anything when it comes to the loading your own filters.  So I have tended to create video pad projects that have these specialized filters loaded and then change the input files as I see fit.

Example, if I want to use up particular color correction filter that is not supported by video pad I will load a project that uses that filter and then change the input file as I see fit before I submit the project to video pad.  Then I would change the output name to my desire and proceed to the next file.  This was because the batch mode of video pad did not support that particular video filter.

-0-

It's the timeline in the project that's limiting your length.  So when a project (VPJ) is saved the timeline length is saved.  Therefore the timeline cannot be longer than what was saved with the project.  That is what I found.  Is there way to get around that?  I would love for it to use the input file's length in the timeline.

Link to comment
Share on other sites

On 2/5/2022 at 11:51 PM, Russ Croucher said:

So when a project (VPJ) is saved the timeline length is saved.

Place a blank clip at the end of the sequence.  Drag it to the desired timeline length.  Grab its right handle and reduce the clip length to the minimum.  Export.

The project will run to the end of the blank clip.

On 2/5/2022 at 11:21 PM, Russ Croucher said:

I would love to find out more information about writing macros inside video pad which I have never done.

There are numerous macro utils available, but they don't run inside Videopad.  The one tested successfully on the first sequence multi-export suggestion is here.

On 2/5/2022 at 10:59 PM, Russ Croucher said:

When you bring up video pad and execute the save button it will only save up to the truncated amount

An example of what appears to be what you are doing...

Save a project with a ten-second file and close VP.  Replace that file on your PC with a twenty-second file by the same name.  Launch the VP project that was saved.  The longer, new file that was substituted is truncated to ten seconds.  This is correct behavior.

The project was saved when the file was ten-seconds long.  The VPJ doesn't know that you have replaced the same-name file with another that is longer.

Instead, load the VPJ that was saved with the short file.  Right-click that file in the bin and REPLACE FILE.  Locate the new, longer file with the same or other name.

Now the timeline will reflect the longer file.  SAVE PROJECT again to update the change.

 

Link to comment
Share on other sites

Actually I don't see any other way to do the software except truncate with what you're given.  It's easy if the file shows up shorter but you can do nothing if it's longer.  What you described above would work but it would require the the mouse and extra keystrokes.  Remember I'm creating an automated procedure that will handle all cases by replacing each file with a shorter file to solve the problem.  The project file is only saved one time with the dummy file which allows us to change directories add filters different procedures all kinds of things but once all that said, in the form of a macro batch file everything is fixed and the file was never saved again.

Once I am done with the split file I will post my macro on this thread for all the lurkers out there that may read this or just for interest.
 

Link to comment
Share on other sites

"borate" when you get a chance I'd like you to check my procedure.  I now have an official procedure that will split MP4 files greater than 4 GB in size into 2 pieces.  I do this because some of the cheaper DVD/Blu-ray/flash drive players will only play FAT32 videos which are limited to 4 GB in size for one file.  So a small solution is to split into 2 files A and B.  This doubles our size to 8 GB.

So this batch file goes through all the MP4 files with the given number set and determines if the file is big enough it needs to be split into 2 pieces.  If it is, then it submits a project to video pad which will load the entire video into 2 sequences.  The 1st sequence just does 2 hours and the last sequence does the rest of the file.

My procedure does use a dummy file that is 6 hours and 15 minutes in length.  To retain the lossless mode requirements the file size is set to the 640x480 (old analog video size).  However, the update rate is limited to 5 FPS.  This still allows the lossless mode.  All the files use in all the procedures are less than the 6 hours and 15 minute limit.

Here is the link to my procedure zip file which is a combination of about 6 files

https://1drv.ms/u/s!AuSetTxgq7JxqOlcv7dQq5pVLdP4Jg?e=kUNGYH

This procedure uses a CMD batch file concept.  30 years ago in the early 90s there was a product called "4 DOS".  This was back when Windows was creating Windows 3.1.  I don't remember the company that supported 4 DOS back then.  They then updated their product called "4nt".  That goes back about 25 years ago.  25 years ago everybody was still using command lines except for the newer GUI support with Apple.  Anyway, Microsoft abandoned the command line interface when they came out with 4 NT.  All the 40 commands that are in the command line have not changed to 25 years except for just a few tweaks to run with the new operating systems.

Anyway, JP software has taken over the 4 NT concept and still supports it.  They have probably added thousands of commands to the command line concept.  You basically pay a license  fee for one user to do development ($100) and then a free install for all the computers that use the runtime version.  The product is quite incredible, especially if you know any concept of the CMD interface.  Most people don't use command line interface anymore since we now use more Visual Studio and that type of product.  So even the split file that I have above is designed to edit the batch file with your arguments rather than use a command line since no one uses command lines anymore.

JP software has changed the name of 4NT to TCC.  They are currently up to version 28 and all of my procedures still use version 27.  Here is a link to their free runtime install if you want to try it.

/downloads/v27/tcc-rt.exe

here is a link to their website

https://jpsoft.com/

-0-

I want to explain why in my procedure doesn't store the "i.mp4" and why I store it as "i615.mp4".  This is because video pad has a method of looking for the input file in your current directory 1st and if it cannot find it there, it will look in the procedure where the project was stored.  So if there was a "i.mp4" in another directory it would use it.  This procedure relies on the fact that it update this file constantly and cannot allow "i.mp4" droppings to be left lying around.  Therefore the procedure makes a point to make sure that it is deleted since it is considered a temporary file.

So I force the user to rename or copy the "i615.mp4" to the generic "i.mp4" so it would not be found accidentally in another directory.

Link to comment
Share on other sites

Below is a small excerpt from the procedure file that splits the project into 2 pieces.  This is the real meat of the operation.  They make the procedure so easy to stuff keys into other processes with the KEYSTACK command..


rem the file to be split will be put into "i.mp4"
copy %fname%.mp4 i.mp4 /q
rem the "split.vpj" defaults to 2 hours and other projects can be selected for shorter length is required
copy split.vpj %fname%.vpj /q
if exist "%fname% (Sequence 1).mp4" del "%fname% (Sequence 1).mp4" /q
if exist "%fname% (Sequence 2).mp4" del "%fname% (Sequence 2).mp4" /q
rem start videopad project loading the file with sound before continuing
start %fname%.vpj
gosub :waitVideopad
rem we have no key shortcut for "export all sequences"
keystack Alt f Down Down Down Down Down Down Down Down Enter Enter Enter Enter Enter
rem wait for videopad to export both sequence files
gosub :waitVideopad
rem quit videopad without saving
keystack /W9 alt-F4 /w9 tab enter
delay 5
rem rename the sequence files to (A and B).
if exist %fname%A.mp4 del %fname%A.mp4 /q
if exist %fname%B.mp4 del %fname%B.mp4 /q
ren "%fname% (Sequence 1).mp4" %fname%A.mp4 /q
ren "%fname% (Sequence 2).mp4" %fname%B.mp4 /q
del %fname%.vpj /q
del %fname%.mp4 /q

Notice in the procedure above, we don't have an export key for the key for export all sequences and I am dependent on the menu that video pad is currently using for v11.17 version.  I need this request a shortcut key.

Link to comment
Share on other sites

Okay, I updated my procedure that splits the file into 2/3 pieces.  This is now a lot more complex in the sense that it handles up to 3 pieces if needed.  In other words, it will handle up to 12 GB files.  It makes A, B, and C files.  It uses several different methods of determining if any of those 3 files are larger than 4 GB.  If any of them are it chooses a smaller split project.  It starts out with 2 hours for each sequence or 6 hours.  If any of those files are greater then 4 GB it would choose the 3 hour project or one hour per sequence.  If any of those 3 are greater than 4 GB.  It will choose a 40 minute sequence version.  This allows for long VHS files and short complex files that use 1920x1080.

https://1drv.ms/u/s!AuSetTxgq7JxqOlcv7dQq5pVLdP4Jg?e=kUNGYH

The one problem that I ended up with is determining that I needed the output to be the same resolution as the input file.  This is one of the selections of the export but it would be nice if defaults to this for the export all sequences option.  Here is the excerpt of the actual video pad submission that key stuffing causes my problems.

  rem start videopad project loading the file with sound before continuing
  start %fname%.vpj
  gosub :waitVideopad
  rem we have no key shortcut for "export all sequences"
  keystack Alt f Down Down Down Down Down Down Down Down Enter Enter Enter tab tab tab Down Down Down Down Down Down Down Down Down Down Down Down Enter Enter Enter
  rem wait for videopad to export both sequence files
  gosub :waitVideopad
  rem quit videopad without saving
  keystack /W9 alt-F4 /w9 tab enter
  delay 5

-0-

I just want to point out that the zip file in the previous post includes 3 projects are that are not needed but were used in the testing.  I have a 2 minute, 3 minute, and 4 minute project that was used for the testing since I don't want to wait for a 2 hour conversion to make sure something works.  I also have a 10 minute dummy project "i012 .mp4" that is just a 10 minute portion of the baseball game as a dummy file.  This makes testing the project fast.

Link to comment
Share on other sites

  • 3 weeks later...

I had to update my split procedure because of the video pad file changes in the latest version 11.20.  I requested that they give an export key for the export all sequences but have not seen an update.  From this procedure I need either a key sequence so I can specify the output file type. 

In all cases I need to match the input resolution.  This is actually the default if you don't have a project.  However, a project overrides the default.  If they were to move the auto match resolution to the top of the export list the problem would go away.  However, a project file overrides the default exportfind auto export at the same resolution.

Here is the link to my procedure again.  This is specify higher in the thread.

https://1drv.ms/u/s!AuSetTxgq7JxqOlcv7dQq5pVLdP4Jg?e=kUNGYH

Here is the latest export and I had add several down sequences to accommodate the auto match export

  rem start videopad project loading the file with sound before continuing
  start %fname%.vpj
  gosub :waitVideopad
  rem we have no key shortcut for "export all sequences"
  keystack Alt f Down Down Down Down Down Down Down Down Enter Enter Enter tab tab tab Down Down Down Down Down Down Down Down Down Down Down Down Down Down Down Enter Enter Enter
  rem wait for videopad to export both sequence files
  gosub :waitVideopad
  rem quit videopad without saving
  keystack /W9 alt-F4 /w9 tab enter
  delay 5

Thoughts?

Link to comment
Share on other sites

  • 4 months later...

I had to update my split procedure again(split_1.3) because video pad changed their menu selections in version 11.38.  I do not have a key for export all sequences yet and therefore had to increase my key stuffing by one more down arrow on the main selection.  I requested that they give an export key for the export all sequences but have not seen nothing yet.  From this procedure I need a key sequence so I can specify the output file type. 

In all cases I need to match the input resolution.  This is actually the default if you don't have a project.  However, a project overrides the default.  If they were to move the auto match resolution to the top of the export list the problem would go away.  However, a project file overrides the default export.

Here is the link to my procedure again.  This is specify higher in the thread.

https://1drv.ms/u/s!AuSetTxgq7JxqOlcv7dQq5pVLdP4Jg?e=kUNGYH

Here is the latest export and I had add several down sequences to accommodate the auto match export

  rem start videopad project loading the file with sound before continuing
  start %fname%.vpj
  gosub :waitVideopad
  rem we have no key shortcut for "export all sequences"
  keystack Alt f Down Down Down Down Down Down Down Down Enter Enter Enter tab tab tab Down Down Down Down Down Down Down Down Down Down Down Down Down Down Down Enter Enter Enter
  rem wait for videopad to export both sequence files
  gosub :waitVideopad
  rem quit videopad without saving
  keystack /W9 alt-F4 /w9 tab enter
  delay 5

thoughts?

Link to comment
Share on other sites

This thread has been brought to the attention of the developers.

It might be less frustrating to simply stick with a version that's working well for you.

Many updates are maintenance releases that may be of little or no benefit for your processes.

Link to comment
Share on other sites

Yes, as a general rule I do that.  This last version was 10.78 I was using which was last fall.  I figured it was time to upgrade.  It seems like most the problems I ran in the last few months have been fixed.  That particular batch file, I have a way of making the problem down to just several minutes so it doesn't take me very long to realize what version was the problem.  I fixed the problem that's probably good for another year.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...