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

@salihgun/react-native-video-processor

v0.3.1

Published

test

Downloads

484

Readme

@salihgun/react-native-video-processor

Video processing functions using @ffmpeg-kit

Preview

Table of contents

Installation

yarn add @salihgun/react-native-video-processor ffmpeg-kit-react-native

or

npm install @salihgun/react-native-video-processor ffmpeg-kit-react-native

Android Setup

  • Edit android/build.gradle file and add the package name in ext.ffmpegKitPackage variable.
    ext {
        ffmpegKitPackage = "full-gpl-lts"
    }
  • Edit android/app/build.gradle file and add packaging options above defaultConfig.
packagingOptions {
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
    }

iOS Setup

  • Edit ios/Podfile file and add the package name as subspec. After that run pod install again.
pod 'ffmpeg-kit-react-native', :subspecs => ['full-gpl-lts'], :podspec => '../node_modules/ffmpeg-kit-react-native/ffmpeg-kit-react-native.podspec'

Usage

// ** Important! Please install react-native-video to run this component.
// yarn add react-native-video

import VideoManager, { TrimmerComponent } from '@salihgun/react-native-video-processor'

  // Use createFreames function to create frames for the video // fps=5 for the example
  const framesPath = await VideoManager.createFrames(videoPath, 5);
  
  //User getVideoInfo function to get video duration
  const videoInfo = await VideoManager.getVideoInfo(videoPath)

  // Then you can use trimVideo function to trim selected part.
  const clippedVideoPath = await VideoManager.trimVideo(videoPath, value, clipDuration)

  <TrimmerComponent
    path={videoPath}
    seekValue={value}
    setSeekValue={setValue}
    framesPath={framesPath}
    duration={videoInfo.duration} // Total video duration
    clipDuration={clipDuration} // You can set the clip duration
  />
import VideoManager from '@salihgun/react-native-video-processor'


const result = await VideoManager.getVideoInfo(videoPath)

// example result
// result = {
//  duration: 4.5,
//  creationDate: "2022-11-11T19:08:08.547Z",
//  size: 496145 bytes,
//  bit_rate: 882035,
//  width: 320,
//  height: 568,
//  frame_rate: "30/1",
//  codec_name: "h264",
//  codec_type: "video",
//  sample_aspect_radio: "1:1",
// }
import VideoManager from '@salihgun/react-native-video-processor'

const thumbnailPath = await VideoManager.createThumbnail(videoPath)
import VideoManager from '@salihgun/react-native-video-processor'

const [startTime, setStartTime] = React.useState<string>('');
const [duration, setDuration] = React.useState<string>('');

const clippedVideoPath = await VideoManager.trimVideo(videoPath, startTime, duration)
import VideoManager from '@salihgun/react-native-video-processor'

// createFrames function has two parameters. Video path and an optional fps value which is default 1
const framesPath = await VideoManager.createFrames(videoPath, 3) // fps = 3

// render method
 <ScrollView horizontal>
    {[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((_, index) => {
        return (
            <Image
                key={index}
                style={styles.frame}
                source={{ uri: `${framesPath}${index + 1}.jpg` }}
            />
        );
    })}
 </ScrollView>
import VideoManager from '@salihgun/react-native-video-processor'

const reversedVideoPath = await VideoManager.reverseVideo(videoPath)
import VideoManager from '@salihgun/react-native-video-processor'
import RNFS from "react-native-fs";

// You can use RNFS to create a video path
const outputPath = RNFS.DocumentDirectoryPath + "/mergedVideos.mp4";

// There are two optional scale parameters to merge video
// height and width default value is 1920x1080
// you can change it if you need
const mergedVideoPath = await VideoManager.mergeVideos(videoPathsArray,outputPath);
import VideoManager from '@salihgun/react-native-video-processor'

// Set 'reorder' option to true if you want to reorder videos.
const boomerangVideoPath = await VideoManager.boomerang(videoPath) // reorder = false
import VideoManager from '@salihgun/react-native-video-processor'

// Use speed property to set speed. Default is 1
const speedVideoPath = await VideoManager.setSpeed(videoPath) // speed = 1

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library