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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nativescript-ffmpeg-plugin

v0.0.2

Published

FFmpeg for NativeScript

Readme

NativeScript FFmpeg

Build Status NPM version Downloads Twitter Follow

Installation

tns plugin add nativescript-ffmpeg-plugin

Usage

  1. Execute commands.

    • Use execute() method with a single command line and an argument delimiter
    import { LogLevel, FFmpeg } from 'nativescript-ffmpeg-plugin';
    
    FFmpeg.execute('-i file1.mp4 -c:v mpeg4 file2.mp4', ' ').then(result => console.log("FFmpeg process exited with result " + result));
    • Use executeWithArguments() method with an array of arguments
    import { LogLevel, FFmpeg } from 'nativescript-ffmpeg-plugin';
    
    FFmpeg.executeWithArguments(["-i", "file1.mp4", "-c:v", "mpeg4", "file2.mp4"]).then(result => console.log("FFmpeg process exited with result " + result));
  2. Check execution output. Zero represents successful execution, non-zero values represent failure.

    FFmpeg.getLastReturnCode().then(result => {
        console.log("Last return code: " + result);
    });
    
    FFmpeg.getLastCommandOutput().then(result => {
        console.log("Last command output: " + result;
    });
  3. Stop an ongoing operation.

    FFmpeg.cancel();
  4. Get media information for a file.

    • Print all fields
    FFmpeg.getMediaInformation('<file path or uri>').then(info => {
        console.log('Result: ' + JSON.stringify(info));
    });
    • Print selected fields
    FFmpeg.getMediaInformation('<file path or uri>').then(info => {
        console.log('Result: ' + JSON.stringify(info));
        console.log('Media Information');
        console.log('Path: ' + info.path);
        console.log('Format: ' + info.format);
        console.log('Duration: ' + info.duration);
        console.log('Start time: ' + info.startTime);
        console.log('Bitrate: ' + info.bitrate);
        if (info.streams) {
            for (var i = 0; i < info.streams.length; i++) {
                console.log('Stream id: ' + info.streams[i].index);
                console.log('Stream type: ' + info.streams[i].type);
                console.log('Stream codec: ' + info.streams[i].codec);
                console.log('Stream full codec: ' + info.streams[i].fullCodec);
                console.log('Stream format: ' + info.streams[i].format);
                console.log('Stream full format: ' + info.streams[i].fullFormat);
                console.log('Stream width: ' + info.streams[i].width);
                console.log('Stream height: ' + info.streams[i].height);
                console.log('Stream bitrate: ' + info.streams[i].bitrate);
                console.log('Stream sample rate: ' + info.streams[i].sampleRate);
                console.log('Stream sample format: ' + info.streams[i].sampleFormat);
                console.log('Stream channel layout: ' + info.streams[i].channelLayout);
                console.log('Stream sar: ' + info.streams[i].sampleAspectRatio);
                console.log('Stream dar: ' + info.streams[i].displayAspectRatio);
                console.log('Stream average frame rate: ' + info.streams[i].averageFrameRate);
                console.log('Stream real frame rate: ' + info.streams[i].realFrameRate);
                console.log('Stream time base: ' + info.streams[i].timeBase);
                console.log('Stream codec time base: ' + info.streams[i].codecTimeBase);
            }
        }
    });
  5. Enable log callback and redirect all FFmpeg logs to a console/file/widget.

    logCallback = (logData) => {
        console.log(logData.text);
    };
    ...
    FFmpeg.enableLogCallback(logCallback);
  6. Enable statistics callback and follow the progress of an ongoing operation.

    statisticsCallback = (statisticsData) => {
        console.log('Statistics; frame: ' + statisticsData.videoFrameNumber.toFixed(1) + ', fps: ' + statisticsData.videoFps.toFixed(1) + ', quality: ' + statisticsData.videoQuality.toFixed(1) +
        ', size: ' + statisticsData.size + ', time: ' + statisticsData.time);
    };
    ...
    FFmpeg.enableStatisticsCallback(statisticsCallback);
  7. Poll statistics without implementing statistics callback.

    FFmpeg.getLastReceivedStatistics().then(stats => console.log('Stats: ' + JSON.stringify(stats)));
  8. Reset statistics before starting a new operation.

    FFmpeg.resetStatistics();
  9. Set log level.

    FFmpeg.setLogLevel(LogLevel.AV_LOG_WARNING);
  10. Register your own fonts by specifying a custom fonts directory, so they are available to use in FFmpeg filters. Please note that this function can not work on relative paths, you need to provide full file system path.

    • Without any font name mappings
    FFmpeg.setFontDirectory('<folder with fonts>', null);
    • Apply custom font name mappings. This functionality is very useful if your font name includes ' ' (space) characters in it.
    FFmpeg.setFontDirectory('<folder with fonts>', { my_easy_font_name: "my complex font name" });
  11. Use your own fontconfig configuration.

    FFmpeg.setFontconfigConfigurationPath('<fontconfig configuration directory>');
  12. Disable log functionality of the library. Logs will not be printed to console and log callback will be disabled.

    FFmpeg.disableLogs();
  13. Disable statistics functionality of the library. Statistics callback will be disabled but the last received statistics data will be still available.

    FFmpeg.disableStatistics();
  14. List enabled external libraries.

    FFmpeg.getExternalLibraries().then(externalLibraries => {
        console.log(externalLibraries);
    });

License

Apache License Version 2.0, January 2004

See Also