Skip to content

A simple command line PHP script that splits a video into parts based on a timeline using FFmpeg.

License

Notifications You must be signed in to change notification settings

nsmle/video-splitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Video Splitter

A simple command line PHP script that splits a video into parts based on a timeline.

This script aims to break down videos based on timelines such as long videos, tutorials and the like that have timelines like YouTube Videos Segments.

The script uses FFMpeg so you have to install it.

Let's get started then! 😃

Installation

Download the video-splitter.php file with the following command

wget https://raw.githubusercontent.com/nsmle/video-splitter/4e8afe8cdb72e1003a251d3c9972b770dba9da7e/video-splitter.php

or, Clone this repository

git clone https://github.com/nsmle/video-splitter.git

Usage

Replace XXXXXX in $video with the video directory to be split. e.g.

$video = "~/.local/share/videos/video.mp4";

Replace XXXXXX in $folder with desired directory as result of split video. If the directory does not exist, it will be created. e.g.

$folder = "~/.local/share/videos/split";

Replace XXXXXX in $timeline with the timeline of the video to be split. e.g.

$timeline = <<<TIMELINE
00:00:00 - Video split 1
00:02:56 - Video split 2
00:14:56 - Video split 3
00:24:56 - Video split 4
TIMELINE;

To start the split, run the following command.

php video-splitter.php

You can set the log level of FFmpeg by setting it in $logLevel. as default logLevel will be set on error.

Installing FFmpeg

Installing FFmpeg on Ubuntu

  • Start by updating the packages list:
sudo apt update
  • Next, install FFmpeg by typing the following command:
sudo apt install ffmpeg
  • To validate that the package is installed properly use the ffmpeg -version command which prints the FFmpeg version:
ffmpeg -version
  • The output should look something like this:
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)

Installing FFmpeg on Termux

  • Start by updating the packages list:
pkg update && pkg upgrade -y
  • Next, install FFmpeg by typing the following command:
pkg install ffmpeg
  • To validate that the package is installed properly use the ffmpeg -version command which prints the FFmpeg version:
ffmpeg -version
  • The output should look something like this:
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
built with Android (7714059, based on r416183c1)

See FFmpeg installation guide for details.

About

A simple command line PHP script that splits a video into parts based on a timeline using FFmpeg.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages