New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Chop Up a Video Based on Timestamps?
raindog308
Administrator, Veteran
in Help
I have a set of videos that are about 2 hours each. Each contains numerous short lessons - let's say 40 per video.
What I'd like to do is watch each video and mark the start of each lesson, then feed that into an app or script that splits the video file and produces 40 videos from it, each starting and stopping at times I specify.
I know how to do this manually in Final Cut Pro but...tedious.
Is there a way to do this with an app, or some kind of command-line script? Linux (Debian, natch), macOS, and Windows are all available platforms.
Comments
https://shotstack.io/learn/use-ffmpeg-to-trim-video/
ffmpeg best tool
I use copilot + ffmpeg.
Use the following command to cut the video:
-ss: Specifies the start time
-to: Specifies the duration from start to end
-i input.mp4: input video file.
-c copy: Trims the video via stream copy (very fast).
This does not re-encode the video, ensuring fast processing.
!/bin/bash # For Linux/macOS
@ECHO OFF # For Windows
Path to your video file
input_video="path/to/your/video.mp4"
Loop through each lesson with start and end times
while IFS=':' read -r start_time end_time output_name; do
ffmpeg -i "$input_video" -ss "$start_time" -to "$end_time" -c copy "output_name.mp4"
done < timestamps.txt # Replace with your timestamp file path
Perhaps have a look at lossless-cut?
https://github.com/mifi/lossless-cut
It's a ffmpeg gui. You could watch the video in it, since you're doing that anyway, and select the cut points as you go along.
We print the video on KODAK motion picture film and cut it with scissors.
The analog way is the most intuitive.
The undo takes longer time
This can be done using MPV player keybindings and Lua scripting capabilities.