npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

slicereel

v1.0.11

Published

## Requirements

Downloads

8

Readme

slicereel

Requirements

  • ffmpeg
  • ffprobe

Description

This is a simple command-line tool to slice video into many parts using FFmpeg. You can define each part duration, the output format and much more.

Installation

npm i -g slicereel

Usage

In the example below, all the parts will be saved in the input.mp4.parts folder. Each output file will have the same name as the input file, with the slice of the video duration. For instance, let's suppose input.mp4 has a total of 50 minutes of duration. The output files will be named as:

  • input.0s-20m.mp4
  • input.20m-40m.mp4
  • input.40m-50m.mp4
slicereel -i input.mp4 -o input.mp4.parts -d 20m --out-extension mp4

Resizing the video

When using the --width argument, the video aspect ratio will be automatically kept. In case the required width produces an odd height dimension, the width will be automatically adjusted so the height is divisible by 2, as this is required by FFmpeg.

slicereel -i input.mp4 -o input.mp4.parts --width 200

You can define video/audio bitrate

slicereel -i input.mp4 -o input.mp4.parts -d 10m --video-bitrate 1M --audio-bitrate 32k

Suffixed output files

If you want to add a suffix to the output files, you can use the --suffix argument. For instance, if you want to add the suffix part to the output files, you can do it like this:

slicereel -i input.mp4 -o input.mp4.parts -d 10m --suffix ":startTime-:endTime-part-number-:part"

Trimming

You can tell the command-line tool to start creating the parts from a certain part of the video using the --skip argument. For instance, if you want to start from the 10th minute of the video, you can do it like this:

slicereel -i input.mp4 --skip 6m10s

If you want to get just the first hour of the video, you can do:

slicereel -i input.mp4 --until 1h

Or if you want to skip the first 5 minutes, but stop at end of the first hour of the video, which will result in a 55 minutes video, you can do:

slicereel -i input.mp4 --skip 5m --until 1h

If you're not interested in creating multiple parts of the video. You can tweak this functionality to emit just a single part of the video by setting the duration to the end of the video. For instance, if you want to get just the first 5 minutes of the video, you can do:

slicereel -i input.mp4 --until 5m --duration 5m

Defining the frames-per-second

If the input video has 60fps, and you want to output a video with 20fps, you can do it like this. Since we omitted the -d argumentm, it will default to 60 minutes per part:

slicereel -i input.mp4 -o input.mp4.parts --fps 20

Outputting slices of the audio of the video

slicereel -i input.mp4 -o input.mp4.parts -d 10m --out-extension opus --audio-bitrate 32k

Concurrency and FFmpeg threading

If you want the video slicing to be faster, you can use the --threads argument, which will be passed to ffmpeg, or you can use the --concurrency argument, which will spawn multiple ffmpeg processes. The default value for --threads is 1, and the default value for --concurrency is 1.

slicereel -i input.mp4 -o input.mp4.parts --threads 2 --concurrency 100

If you're using Linux or macOS, you can use all threads available:

slicereel -i input.mp4 -o input.mp4.parts --threads $(nproc)

Duration format

For setting each part to have 1 hour and 30 minutes, you can use the following format:

slicereel -i video.mp4 -d 1h30m

If you wish 10 hour and 30 minutes, you can use:

slicereel -i video.mp4 -d 10h30m

Or, if you wish 10 minutes and 30 seconds, you can use:

slicereel -i video.mp4 -d 10m30s

You can also pass repeated sequences, like:

slicereel -i video.mp4 -d 10s10s10s1s

It will result in 31 seconds for each part, as expected.

More help

slicereel --help
slicereel -h