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

rnvideo-ffmpeg-processor

v1.2.0

Published

A React Native module for video processing using FFmpeg

Downloads

18

Readme

Here’s a sample README.md for your custom React Native NPM package, rnvideo-ffmpeg-processor.

rnvideo-ffmpeg-processor

npm version License

A React Native module that enables powerful video processing using FFmpeg, including features such as trimming, cropping, merging videos, adding text overlays, and much more.

Features

  • Trim Video: Select the start and end times to trim a video.
  • Crop Video: Crop the video to a specific area or aspect ratio.
  • Merge Videos: Combine multiple videos into one.
  • Add Audio: Merge audio files with video files.
  • Text Overlays: Add text to videos with customizable font, color, and position.
  • Apply Filters: Use FFmpeg filters to adjust brightness, contrast, etc.
  • Mute Video: Remove audio tracks from videos.
  • Rotate Video: Rotate videos by 90, 180, or 270 degrees.

Installation

To install this package, run:

npm install rnvideo-ffmpeg-processor

Link Native Modules (if React Native version < 0.60)

For React Native versions below 0.60, you’ll need to link the native modules manually:

npx react-native link react-native-ffmpeg

For React Native 0.60 and above, the module should be auto-linked.

iOS

Make sure you have the latest version of CocoaPods installed, and run:

cd ios
pod install

Android

Add the following to your android/app/build.gradle file:

android {
    ...
    packagingOptions {
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    }
}

Usage

Import the Module

import VideoProcessor from 'rnvideo-ffmpeg-processor';

Trim Video

const trimVideo = async () => {
  try {
    const result = await VideoProcessor.trimVideo(
      '/path/to/video.mp4',
      '00:00:10',
      '00:00:20',
      '/path/to/output.mp4',
    );
    console.log(result); // Success message or error handling
  } catch (error) {
    console.error(error);
  }
};

Crop Video

const cropVideo = async () => {
  try {
    const result = await VideoProcessor.cropVideo(
      '/path/to/video.mp4',
      640,
      360,
      10,
      10,
      '/path/to/output.mp4',
    );
    console.log(result); // Success message or error handling
  } catch (error) {
    console.error(error);
  }
};

Merge Videos

const mergeVideos = async () => {
  try {
    const result = await VideoProcessor.mergeVideos(
      ['/path/to/video1.mp4', '/path/to/video2.mp4'],
      '/path/to/output.mp4',
    );
    console.log(result); // Success message or error handling
  } catch (error) {
    console.error(error);
  }
};

Add Text Overlay

const addTextOverlay = async () => {
  try {
    const result = await VideoProcessor.addTextOverlay(
      '/path/to/video.mp4',
      'Your text here',
      100,
      200,
      '/path/to/output.mp4',
    );
    console.log(result); // Success message or error handling
  } catch (error) {
    console.error(error);
  }
};

Mute Video

const muteVideo = async () => {
  try {
    const result = await VideoProcessor.muteVideo(
      '/path/to/video.mp4',
      '/path/to/output.mp4',
    );
    console.log(result); // Success message or error handling
  } catch (error) {
    console.error(error);
  }
};

Supported Features

  • Trimming: Cut videos by specifying start and end times.
  • Cropping: Resize the video frame by defining width, height, and position.
  • Audio Merge: Add background music or voice-over tracks to your videos.
  • Text Overlay: Add customizable text on video, including color, size, and position.
  • Video Filters: Apply visual filters such as brightness and contrast adjustments.
  • Rotate Video: Rotate videos to any angle (90°, 180°, 270°).
  • Mute Audio: Remove audio from videos.

FFmpeg Commands

Internally, this module leverages FFmpeg commands to process videos. Example commands include:

  • Trim: -ss [start_time] -t [duration] -i [input_path] -c copy [output_path]
  • Crop: -i [input_path] -filter:v "crop=[width]:[height]:[x]:[y]" [output_path]
  • Merge Videos: -i "concat:[file1|file2]" -c copy [output_path]
  • Text Overlay: -i [input_path] -vf drawtext="text='[text]':x=[x]:y=[y]:fontsize=24:fontcolor=white" [output_path]

Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repo.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes and commit (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature-branch).
  5. Submit a pull request.

License

MIT


This project is licensed under the MIT License - see the LICENSE file for details.

Contact

If you have any issues, feel free to open an issue or contact me via GitHub.

Key Sections Included:

  • Installation: How to install and link the package for both iOS and Android.
  • Usage Examples: Detailed code examples for using various features such as trimming, cropping, merging, etc.
  • FFmpeg Commands: Under-the-hood FFmpeg commands for those who want more control.
  • Contributing: Guidelines for contributing to the project.
  • License: License information.

This README.md provides clear instructions for developers to use and contribute to the package.