This batch script trims a user-defined amount of time from the end of all .mp4
videos in the folder where the script is located and saves the trimmed videos to a subdirectory called output_dir
.
- Allows the user to input the trim time in the format
hh:mm:ss
,mm:ss
, orss
. - Automatically adds a minus sign to the user’s input to trim from the end of the video.
- If
ffmpeg.exe
is not found in the script’s directory, it will attempt to useffmpeg
from the system’sPATH
.
- Place the batch script in the folder containing the
.mp4
videos you want to process. - Run the script. It will prompt you to enter the amount of time to trim from the end of each video in the format
hh:mm:ss
,mm:ss
, orss
.- Example:
07:07
is 7 minutes and 7 seconds,07:07:07
is 7 hours, 7 minutes, and 7 seconds.
- Example:
- The script will create an
output_dir
subdirectory if it does not already exist. - It will process each
.mp4
video, trim the specified amount of time from the end, and save the trimmed videos to theoutput_dir
.
Note: If ffmpeg
is not located in the same directory as the script, make sure that the path to ffmpeg
is added to the system PATH
environment variable.
The easiest way is to download the batch-lossless-cut.zip, extract the files into the folder with the videos you want to trim, and run batch-lossless-cut.bat
- FFmpeg must be installed or included in the same directory as the script, or it should be available in the system
PATH
.
If you are using Method 1, you will need to download and install ffmpeg
separately. You can either:
- Add
ffmpeg
to the same directory as the batch script. - Or, add
ffmpeg
to your system’sPATH
environment variable so it can be used globally.