GithubHelp home page GithubHelp logo

transitive-bullshit / ffmpeg-concat Goto Github PK

View Code? Open in Web Editor NEW
835.0 20.0 112.0 12.04 MB

Concats a list of videos together using ffmpeg with sexy OpenGL transitions.

JavaScript 100.00%
ffmpeg fluent-ffmpeg opengl transition

ffmpeg-concat's Introduction

ffmpeg-concat

Concats a list of videos together using ffmpeg with sexy OpenGL transitions.

NPM Build Status JavaScript Style Guide

(example of 9 videos concatenated together with unique transitions)

(note that the quality and fps is only poor due to the GIF preview; here is the original)

Intro

FFmpeg is the de facto standard in command-line video editing, but it is really difficult to concatenate videos together using non-trivial transitions. Here are some convoluted examples of a simple cross-fade between two videos. FFmpeg filter graphs are extremely powerful, but for implementing transitions, they are just too complicated and error-prone.

GL Transitions, on the other hand, is a great open source initiative spearheaded by Gaëtan Renaudeau that is aimed at using GLSL to establish a universal collection of transitions. Its extremely simple spec makes it really easy to customize existing transitions or write your own as opposed to struggling with complex ffmpeg filter graphs.

This module and CLI make it easy to concat videos together using gl-transitions.

Install

This module requires ffmpeg to be installed.

npm install --save ffmpeg-concat

# or if you want to use the CLI
npm install -g ffmpeg-concat

This package runs on Linux, macOS, and Windows.

Node.js versions 10.13.0 and up are supported. Note (macOS only): due to an inadvertant low-level breaking change in libuv's process handling code, OpenGL is not supported when running Node.js version 12.13.1 through to 13.6.0 on macOS. A fix has been released in Node.js version 13.7.0. A fix for 12.x is pending. Other platforms are unaffected.

CLI

  Usage: ffmpeg-concat [options] <videos...>

  Options:

    -V, --version                         output the version number
    -o, --output <output>                 path to mp4 file to write (default: out.mp4)
    -t, --transition-name <name>          name of gl-transition to use (default: fade)
    -d, --transition-duration <duration>  duration of transition to use in ms (default: 500)
    -T, --transitions <file>              json file to load transitions from
    -f, --frame-format <format>           format to use for temp frame images (default: raw)
    -c, --concurrency <number>            number of videos to process in parallel (default: 4)
    -C, --no-cleanup-frames               disables cleaning up temp frame images
    -O, --temp-dir <dir>                  temporary working directory to store frame data
    -v, --verbose                         enable verbose logging from FFmpeg
    -h, --help                            output usage information

  Example:

    ffmpeg-concat -t circleopen -d 750 -o huzzah.mp4 0.mp4 1.mp4 2.mp4

Usage

const concat = require('ffmpeg-concat')

// concat 3 mp4s together using 2 500ms directionalWipe transitions
await concat({
  output: 'test.mp4',
  videos: [
    'media/0.mp4',
    'media/1.mp4',
    'media/2.mp4'
  ],
  transition: {
    name: 'directionalWipe',
    duration: 500
  }
})
// concat 5 mp4s together using 4 different transitions
await concat({
  output: 'test.mp4',
  videos: [
    'media/0.mp4',
    'media/1.mp4',
    'media/2.mp4',
    'media/0.mp4',
    'media/1.mp4'
  ],
  transitions: [
    {
      name: 'circleOpen',
      duration: 1000
    },
    {
      name: 'crossWarp',
      duration: 800
    },
    {
      name: 'directionalWarp',
      duration: 500,
      // pass custom params to a transition
      params: { direction: [ 1, -1 ] }
    },
    {
      name: 'squaresWire',
      duration: 2000
    }
  ]
})

API

concat(options)

Concatenates video files together along with OpenGL transitions. Returns a Promise for when the output video has been written.

Note that you must specify videos, output, and either transition or transitions.

Note that the output video's size and fps are determined by the first input video.

options

videos

Type: Array<String> Required

Array of videos to concat, where each item is a path or URL to a video file.

output

Type: String Required

Path to an mp4 video file to write.

Note: we currently only support outputting to mp4; please open an issue if you'd like to see support for more formats.

transition

Type: Object

Specifies a default transition to be used between each video.

Note that you must specify either transition or transitions, depending on how much control you want over each transition. If you specify both, transitions takes precedence.

// example
const transition = {
  duration: 1000, // ms
  name: 'directionalwipe', // gl-transition name to use (will match with lower-casing)
  params: { direction: [1, -1] } // optionally override default parameters
}
transitions

Type: Array<Object>

Specifies a (possibly unique) transition between each video. If there are N videos, then there should be N - 1 transitions.

Note that you must specify either transition or transitions, depending on how much control you want over each transition. If you specify both, transitions takes precedence.

// example
const transitions = [
  {
    duration: 1000,
    name: 'fade'
  },
  {
    duration: 500,
    name: 'swap'
  }
]
audio

Type: String Optional

Path or URL to an audio file to use as the audio track for the output video.

if parameter is not provided - assuming user wants to concat the source scenes audio.

args

Type: Array<String> Optional

Default: ['-c:v', 'libx264', '-profile:v', 'main', '-preset', 'medium', '-crf 20', '-movflags', 'faststart']

Array of output-only ffmpeg command line arguments for the final video.

frameFormat

Type: string Default: raw

The format for temporary frame images. You may, for example, use png or jpg.

Note: the default is raw for performance reasons, as writing and reading raw binary pixel data is much faster than encoding and decoding png frames. Raw format is difficult to preview and debug, however, in which case you may want to change frameFormat to png.

concurrency

Type: Number Default: 4

Max number of videos to process in parallel.

log

Type: Function Default: noop

Optional function to log progress and the underlying ffmpeg commands. You may, for example, use console.log

cleanupFrames

Type: boolean Default: true

By default, we cleanup temporary frame images. Set this to false if you need to debug intermediate results.

tempDir

Type: string Default: random directory in /tmp

The temporary working directory to store intermediate frame data. This is where the frames in cleanupFrames will be saved.

Transitions

Here are some gl-transitions that I've found particularly useful for quality video transitions:

Related

  • ffmpeg-gl-transition - Low-level ffmpeg filter for applying GLSL transitions between video streams (gl-transitions). It allows the use of more advanced and customizable filter graphs, but it requires you to build a custom version of ffmpeg.
  • gl-transitions - Collection of GLSL transitions.
  • fluent-ffmpeg - Underlying ffmpeg wrapper library.
  • awesome-ffmpeg - A curated list of awesome ffmpeg resources with a focus on JavaScript.

License

MIT © Travis Fischer

Support my OSS work by following me on twitter twitter

ffmpeg-concat's People

Contributors

chinanf-boy avatar daniel-habib avatar transitive-bullshit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ffmpeg-concat's Issues

Optional custom path for RAW file writting

Recently I tried to concat two files. However, they are pretty large which resulted in a ton of RAW files being written to my AppData folder (Windows User).

I created a PR that adds a custom path option to resolve the issue if anyone else ever were to come upon it: #18

Please let me know if anything further should be done on it.

Error output when using ffmpeg-concat

Here is the output. I can confirm there there are frames for both scene-0 and scene-1 under /tmp/762eca812ec43c73ae8b96ef24e1c1eb. Any idea what might have gone wrong? For some reason it tries to open the non-existing file scene-1-000000000NaN.raw.

$ ffmpeg-concat -t fade -d 250 -o output.mp4 one.mp4 two.mp4
{ cmd: 'ffmpeg -i two.mp4 -y -pix_fmt rgba -start_number 0 /tmp/762eca812ec43c73ae8b96ef24e1c1eb/scene-1-%012d.raw' }
{ cmd: 'ffmpeg -i one.mp4 -y -pix_fmt rgba -start_number 0 /tmp/762eca812ec43c73ae8b96ef24e1c1eb/scene-0-%012d.raw' }
init-frames: 3702.817ms
concat error { Error: ENOENT: no such file or directory, open '/tmp/762eca812ec43c73ae8b96ef24e1c1eb/scene-1-000000000NaN.raw'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at module.exports (/home/pat/.nvm/versions/node/v8.11.1/lib/node_modules/ffmpeg-concat/lib/get-pixels.js:15:21)
    at Object.draw (/home/pat/.nvm/versions/node/v8.11.1/lib/node_modules/ffmpeg-concat/lib/transition.js:48:28)
    at <anonymous>
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/tmp/762eca812ec43c73ae8b96ef24e1c1eb/scene-1-000000000NaN.raw' }
(node:110396) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/tmp/762eca812ec43c73ae8b96ef24e1c1eb/scene-1-000000000NaN.raw'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at module.exports (/home/pat/.nvm/versions/node/v8.11.1/lib/node_modules/ffmpeg-concat/lib/get-pixels.js:15:21)
    at Object.draw (/home/pat/.nvm/versions/node/v8.11.1/lib/node_modules/ffmpeg-concat/lib/transition.js:48:28)
    at <anonymous>
(node:110396) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 17)
(node:110396) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Video concatenation time missmatch problem!

Thanks for the awesome library

But sometimes I get a time mismatch error like

video x is 5 second, video y is 10 second--- Total video output should be 15 seconds

but the output become only 8 seconds.

But when we concat with y to x instead of x,y we get the full 15 seconds as output.

Is there any solution for this error!

difference between ffmpeg-concat and gl-transition demo

Let's take "angular" transition as an example.
gl-transition demo is here.
transition start from 12 o'clock, rotate anticlockwise .
image

i use ffmpeg-concat "angular" transition, cmd is "ffmpeg-concat -t angular -d 750 -o huzzah.mp4 0.mp4 1.mp4"
transition start from 6 o'clock, rotate clockwise

image

i has checked angular.glsl, there is no difference.

so why this happen?

Setup on an AWS t2 micro

Hi,

I am not able to get this running on a t2 micro running ubuntu. Seems to be an 'gl' issue. require('gl')(10,12) returns null.
Could you please share the setup steps for a headless linux machine.

Much appreciated

Trouble getting -T transitions.json to work

First up, I am using Win10 x64. Via nvm, I am testing using Node 8.

I am attempting to use the -T option via CLI. I have a properly built json, syntax-wise. I know this because I edited it until concat's parser stopped yelling at me about tokens. However! No matter how I finagle the videos in the object or on the console I always get the error that the transitions must = n-1 videos.

I'm using the sample json shown on the front page, with a couple minor tweaks. (directory, quotes)
(Not wrapping in code because it collapsed it, which would probably be hard to read.)

{
"output": "test.mp4",
"videos": [
"0.mp4",
"1.mp4",
"2.mp4",
"0.mp4",
"1.mp4"
],
"transitions": [
{
"name": "circleOpen",
"duration": 1000
},
{
"name": "crossWarp",
"duration": 800
},
{
"name": "directionalWarp",
"duration": 500,
"params": { "direction": [ 1, -1 ] }
},
{
"name": "squaresWire",
"duration": 2000
}
]
}

console output: https://i.imgur.com/uoRbxLi.png
Again, any combination of filenames on/off console or in/out the json produces this error with the -T option.

Just a question

I have everything working, running ffmpeg-concat as a promise. Everything is awesome.

What is the best way to know when the processing has finished? Is there a check I can make, or is there a flag that gets thrown when processing is complete?

At the moment I've got to set a timeout to a high number to make sure my processing completes so that I can resolve the promise and move the app logic forward.

Thanks very much!

Porting to emscripten

Hello Guys

Need a quick help here.
Is it possible to use it with emscripten build i.e. ffmpeg.js in the browser environment?

concat error Error: failed to create OpenGL context

Hi i got this error, i don't have any idea about how to fix it:
I used this command: ffmpeg-concat -t fade -d 500 -o test.mp4 job.mp4

cmd: 'ffmpeg -i test.mp4 -y -pix_fmt rgba -start_number 0 /tmp/43dc39c673c7ec15c4af716423d9af17/scene-1-%012d.raw' } init-frames: 9202.664ms concat

error Error: failed to create OpenGL context at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/context.js:22:11)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/render-frames.js:19:21)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/index.js:44:30)
at (node:15718) UnhandledPromiseRejectionWarning:

Error: failed to create OpenGL context
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/context.js:22:11)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/render-frames.js:19:21)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/index.js:44:30)
at (node:15718) UnhandledPromiseRejectionWarning: Unhandled promise rejection.

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4) (node:15718) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I am using Debian 9, node v9.11.1, npm v5.8.0, i have mesa and xvfb installed.

Windows Install Issue

Hello, thank you for the software. I know it takes time to develop quality code.

I cannot get past the basic install of ffmpeg-concat, it appears to request a file that simply doesn't exist, a package.json. My initial attempt was through cygwin (my default building environment), then through an elevated cmd prompt. Both appear to have the same error.

While I'm more or less proficient in building files from source I have installed npm just for this bit of code; I am completely unfamiliar with the environment's expectations.

Below is the entire log. Thanks in advance for your time.
2019-02-28T04_53_53_929Z-debug.log

On Linux (Ubuntu 16.04 LTS) , ffmpeg-concat on CLI given an error.

concat error TypeError: Cannot destructure property width of 'undefined' or 'null'.
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/init-frames.js:45:13)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
(node:6979) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property width of 'undefined' or 'null'.
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/init-frames.js:45:13)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
(node:6979) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:6979) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

concat error Error: failed to create OpenGL context

I run ffmpeg-concat in a centos sever, Here is the output

[root@A01-R04-I220-60 media]# Xvfb :99 &
[1] 39027
[root@A01-R04-I220-60 media]# export DISPLAY=:99
[root@A01-R04-I220-60 media]# echo $DISPLAY
:99
[root@A01-R04-I220-60 media]# ffmpeg-concat 1.mp4 2.mp4 -o test.mp4
{ cmd:
'ffmpeg -i 2.mp4 -y -pix_fmt rgba -start_number 0 /tmp/d99b3ba34f3962a5fcef521e48c8f094/scene-1-%012d.raw' }
{ cmd:
'ffmpeg -i 1.mp4 -y -pix_fmt rgba -start_number 0 /tmp/d99b3ba34f3962a5fcef521e48c8f094/scene-0-%012d.raw' }
init-frames: 675.932ms
ffmpeg-concat: 729.122ms
concat error Error: failed to create OpenGL context
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/context.js:22:11)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/render-frames.js:19:21)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/index.js:47:32)
(node:51795) UnhandledPromiseRejectionWarning: Error: failed to create OpenGL context
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/context.js:22:11)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/render-frames.js:19:21)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/index.js:47:32)
(node:51795) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:51795) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Cannot find ffprobe

Command :- ffmpeg-concat -t circleopen -d 750 -o final.mp4 zoom.mp4 zoom1.mp4

ffmpeg-concat: 43.491ms
concat error { Error: spawn ffprobe ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn ffprobe',
path: 'ffprobe',
spawnargs:
[ '-print_format',
'json',
'-show_error',
'-show_format',
'-show_streams',
'zoom.mp4' ],
stdout: '',
stderr: '',
failed: true,
signal: null,
cmd: 'ffprobe -print_format json -show_error -show_format -show_streams zoom.mp4',
timedOut: false,
killed: false }
(node:20017) UnhandledPromiseRejectionWarning: Error: spawn ffprobe ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
(node:20017) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:20017) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Could anybody help me with this problem,

ffprobe PATH issues

This package appears to fail if ffprobe is not stored in the PATH. Specifically, the ffmpeg-probe wrapper calls ffprobe directly even if the path has been specified to fluent-ffmpeg.

A suggestion would be to allow settings the executable path explicitly as seen in fluent-ffmpeg, or to support setting an environment variable for the ffprobe path.

Details can be seen here: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#ffmpeg-and-ffprobe

Install Issue - msbuild

Having an issue during installation. First I needed to install Python. I'm not sure why this is necessary since it's not listed in the req's. But that did allow me to progress further. Then I hit an msbuild issue:

Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".```

I'm less positive about how to work around this and didn't see it in the documentation.

"SyntaxError: Unexpected token" on Debian 9

I installed it successfully on my Debian 9, and when i wanted to generate a video with transition effect with this command line: ffmpeg-concat -t circleopen -d 750 0.mp4 1.mp4 -o output.mp4

I got this error message:
/usr/lib/node_modules/ffmpeg-concat/lib/index.js:12 module.exports = async (opts) => { ^ SyntaxError: Unexpected token ( at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:549:28) at Object.Module._extensions..js (module.js:586:10) at Module.load (module.js:494:32) at tryModuleLoad (module.js:453:12) at Function.Module._load (module.js:445:3) at Module.require (module.js:504:17) at require (internal/module.js:20:19) at Object.<anonymous> (/usr/lib/node_modules/ffmpeg-concat/index.js:4:18)

have you an idea?

Debian Dependancies?

Installed on new Debian 9 (stretch) server. Didn't like await, removed and got openGL error

const concat = require('ffmpeg-concat')

// concat 3 mp4s together using 2 500ms directionalWipe transitions
concat({
  output: 'test.mp4',
  videos: [
    'cut1.mp4',
    'cut22mp4'
  ],
  transition: {
    name: 'directionalWipe',
    duration: 500
  }
})
dustin@vultr:~/vrobot$ node index.js 
/home/dustin/vrobot/index.js:4
await concat({
^^^^^

SyntaxError: await is only valid in async function
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

dustin@vultr:~/vrobot$ vi index.js  (remove await)

dustin@vultr:~/vrobot$ node index.js 
{ cmd: 'ffmpeg -i cut1.mp4 -y -pix_fmt rgba -start_number 0 /tmp/4a1e082289b9aa5e6b06d0f4119a8131/scene-0-%012d.raw' }
{ cmd: 'ffmpeg -i cut2.mp4 -y -pix_fmt rgba -start_number 0 /tmp/4a1e082289b9aa5e6b06d0f4119a8131/scene-1-%012d.raw' }
init-frames: 33818.075ms
(node:6314) UnhandledPromiseRejectionWarning: Error: failed to create OpenGL context
    at module.exports (/home/dustin/vrobot/node_modules/ffmpeg-concat/lib/context.js:22:11)
    at module.exports (/home/dustin/vrobot/node_modules/ffmpeg-concat/lib/render-frames.js:19:21)
    at module.exports (/home/dustin/vrobot/node_modules/ffmpeg-concat/lib/index.js:44:30)
    at <anonymous>
(node:6314) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:6314) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

windows installation issue

Unable to install ffmpeg-concat on windows

Hey,i tried to install ffmpeg-concat as mentioned in the docs,before i tried this using latest versions of node and python i faced the same error, after going through the closed issues as suggested by author in one of those closed issues,i have uninstalled the latest node version and installed node-8 and python 2.7 , still i'm getting the following errors from the past 2 days.
Screenshot (6).

here are the steps i have followed to install ffmpeg-concat

npm install --global --production windows-build-tools
npm install --global node-gyp
setx PYTHON "path\python27\python.exe"
npm install -g ffmpeg-concat.

SyntaxError: Unexpected token ...t

I think there is a typo as even running ffmpeg-concat --version gives me this output:

/usr/local/lib/node_modules/ffmpeg-concat/lib/init-frames.js:118
    ...t
    ^^^

The version of node js:

$node --version
v8.0.0

concat error Error: failed to create OpenGL context

Hello!

I deployed my application on an Ubuntu 18.04 remote Server and than acuered the following error when adding the transitions.
I tried to configure everything properly. Have mesa installed..

concat error Error: failed to create OpenGL context (node:31455) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:31455) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I found similar issues here and tried everything, but I am still not able to fix it..
I would be very thankful to any suggestions from you!

Getting concat error Error: ffmpeg exited with code 1:

Hi,
I am trying to run the command from the centos os but i am getting the following error.

1 file was 14 mb and 7 mb, Is there any file restriction or format should i need to pass.
Please clarify.

**xvfb-run -s "-ac -screen 0 1280x1024x24" ffmpeg-concat  -t circleopen -d 750 -o opengl/javio.mp4 /home/captionsly/app/media/2/output/1/6990_output.mp4 /home/captionsly/app/media/2/output/1/9622_output.mp4**

{ cmd:
   'ffmpeg -i /home/captionsly/app/media/2/output/1/6990_output.mp4 -y -pix_fmt rgba -start_number 0 /tmp/5500f612fd30bb055a8a1438b88f34ef/scene-0-%012d.raw' }
{ cmd:
   'ffmpeg -i /home/captionsly/app/media/2/output/1/9622_output.mp4 -y -pix_fmt rgba -start_number 0 /tmp/5500f612fd30bb055a8a1438b88f34ef/scene-1-%012d.raw' }
ffmpeg-concat: 57154.073ms
concat error Error: ffmpeg exited with code 1: av_interleaved_write_frame(): Input/output error
frame=  233 fps=4.1 q=-0.0 Lsize=N/A time=00:00:07.77 bitrate=N/A    
video:1887300kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

    at ChildProcess.<anonymous> (/opt/cpanel/ea-nodejs10/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
(node:44646) UnhandledPromiseRejectionWarning: Error: ffmpeg exited with code 1: av_interleaved_write_frame(): Input/output error
frame=  233 fps=4.1 q=-0.0 Lsize=N/A time=00:00:07.77 bitrate=N/A    
video:1887300kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

    at ChildProcess.<anonymous> (/opt/cpanel/ea-nodejs10/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
(node:44646) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:44646) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

UnhandledPromiseRejectionWarning error on CLI

Hi! I'm trying to use the library on node and on the CLI, I'm getting the same error in both cases.

This is the command I'm running on terminal:
$ ffmpeg-concat -t circleopen -d 1000 -o test.mp4 0.mp4 1.mp4

Using
macOS High Sierra 10.13.6
node v10.15.3

Sorry if it's a noob issue but I haven't found anything guiding me to what I'm doing wrong

Output:

ffmpeg-concat: 32.939ms
concat error { Error: spawn ffprobe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn ffprobe',
  path: 'ffprobe',
  spawnargs:
   [ '-print_format',
     'json',
     '-show_error',
     '-show_format',
     '-show_streams',
     '0.mp4' ],
  stdout: '',
  stderr: '',
  failed: true,
  signal: null,
  cmd:
   'ffprobe -print_format json -show_error -show_format -show_streams 0.mp4',
  timedOut: false,
  killed: false }
(node:96785) UnhandledPromiseRejectionWarning: Error: spawn ffprobe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
(node:96785) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:96785) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Video length of each clip is not preserved

I have two video files 1.mp4 and 4.mp4 of duration 5 seconds each.
The files are uploaded at location - https://drive.google.com/drive/folders/1o3n-qLuvzSctzB5zXRfey_ViNScn8kwo?usp=sharing

Case 1 :
Command - ffmpeg-concat -t 'Directional' -d 1000 -o final.mp4 1.mp4 4.mp4
I am getting video of duration 5 seconds instead of 10. The second video appears only for 1 second.

Case 2 :
Command - ffmpeg-concat -t 'Directional' -d 1000 -o final.mp4 4.mp4 1.mp4
Here I am getting video of duration 9 seconds instead of 10.

The questions are -

  1. What is the error in the first case? The total length of the video should be 10 seconds.
  2. How can we preserve the original length of the each video?

Thanks.

Create docker container for ffmpeg-concat?

Would you consider making a docker container that has ffmpeg+node+ffmpeg-concat? This would make it super easy for people to test out ffmpeg-concat to see if it meets their needs without jumping through the tons of (sometimes very difficult) hoops of building it themselves.

Having containers like jrottenberg/ffmpeg as a base may be helpful.

large temp storage requirements

Hello,

when running the CLI tool on Mac OS Sierra 10.13.5 to concatenate two mp4 videos using the basic command you provided as an example

ffmpeg-concat -t circleopen -d 750 -o output.mp4 1.mp4 2.mp4

I end up with "Running out of storage" Mac os error. The system "consumes" all the storage left on my HDD - more than 20 GB for this single command.

Both videos I want to concatenate have around 4 MB. You can find the download link for one of them below. They both have the same properties (codecs, resolution, etc.)
https://1drv.ms/v/s!Ao8YJqxCyIpOhQLXKdJVGj7l_iJI

"Cannot find ffmpeg error" when run from PHP

I have successfully gotten ffmpeg-concat to work from the command line but it's failing with the following error when trying to run it using both system() & exec() in PHP:

concat error Error: Cannot find ffmpeg
at /usr/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:136:22
at /usr/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/capabilities.js:123:9
at wrapper (/usr/lib/node_modules/ffmpeg-concat/node_modules/async/dist/async.js:272:20)
at next (/usr/lib/node_modules/ffmpeg-concat/node_modules/async/dist/async.js:4584:24)
at /usr/lib/node_modules/ffmpeg-concat/node_modules/async/dist/async.js:325:20
at /usr/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/capabilities.js:116:11
at /usr/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/utils.js:223:16
at F (/usr/lib/node_modules/ffmpeg-concat/node_modules/which/which.js:68:16)
at E (/usr/lib/node_modules/ffmpeg-concat/node_modules/which/which.js:80:29)
at /usr/lib/node_modules/ffmpeg-concat/node_modules/which/which.js:89:16
(node:5059) UnhandledPromiseRejectionWarning: Error: Cannot find ffmpeg
at /usr/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:136:22
at /usr/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/capabilities.js:123:9
at wrapper (/usr/lib/node_modules/ffmpeg-concat/node_modules/async/dist/async.js:272:20)
at next (/usr/lib/node_modules/ffmpeg-concat/node_modules/async/dist/async.js:4584:24)
at /usr/lib/node_modules/ffmpeg-concat/node_modules/async/dist/async.js:325:20
at /usr/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/capabilities.js:116:11
at /usr/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/utils.js:223:16
at F (/usr/lib/node_modules/ffmpeg-concat/node_modules/which/which.js:68:16)
at E (/usr/lib/node_modules/ffmpeg-concat/node_modules/which/which.js:80:29)
at /usr/lib/node_modules/ffmpeg-concat/node_modules/which/which.js:89:16
(node:5059) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5059) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

FFMPEG is installed & accessible on the system, and I've also installed it in Node.js using:

npm install --unsafe-perm -g @ffmpeg-installer/ffmpeg

The command being run is:

xvfb-run -s '-ac -screen 0 1280x1024x24' /usr/bin/ffmpeg-concat -T /var/www/html/transitions.json -o /var/www/html/videos/test.mp4 vid1.mp4 vid2.mp4 vid3.mp4

Use image instead of video

Hi

Thanks for this package 👍

Instead of using video, can we use an image to create a video slideshow with this transition?

install issues

after installing npm and trying to install ffmpeg-concat (on OSX 10.13.6) I run into all sorts of permission errors. First, I get this:

$ npm install -g ffmpeg-concat
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access '/usr/local/lib/node_modules'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tom/.npm/_logs/2018-08-21T03_36_34_091Z-debug.log

Note that I was doing this as an administrator user, so...

When I try doing this:

sudo npm install -g ffmpeg-concat
/usr/local/bin/ffmpeg-concat -> /usr/local/lib/node_modules/ffmpeg-concat/index.js

Looks like it works, right? No:

$ ffmpeg-concat -v
/usr/local/lib/node_modules/ffmpeg-concat/node_modules/bindings/bindings.js:96
throw err
^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/build/webgl.node
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/build/Debug/webgl.node
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/build/Release/webgl.node
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/out/Debug/webgl.node
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/Debug/webgl.node
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/out/Release/webgl.node
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/Release/webgl.node
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/build/default/webgl.node
→ /usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/compiled/8.11.4/darwin/x64/webgl.node
at bindings (/usr/local/lib/node_modules/ffmpeg-concat/node_modules/bindings/bindings.js:93:9)
at Object. (/usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/webgl.js:4:35)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/lib/node_modules/ffmpeg-concat/node_modules/gl/node_index.js:2:13)

Not sure what to try.

On Linux (Ubuntu 16.04 LTS) with shell_exec() command i am getting an error.

{ cmd: 'ffmpeg -i /var/www/html/testing_video/3.mp4 -y -pix_fmt rgba -start_number 0 /tmp/eb9e2ea882c1871dd237e7a888be1c06/scene-2-%012d.raw' }
{ cmd: 'ffmpeg -i /var/www/html/testing_video/1.mp4 -y -pix_fmt rgba -start_number 0 /tmp/eb9e2ea882c1871dd237e7a888be1c06/scene-0-%012d.raw' }
{ cmd: 'ffmpeg -i /var/www/html/testing_video/2.mp4 -y -pix_fmt rgba -start_number 0 /tmp/eb9e2ea882c1871dd237e7a888be1c06/scene-1-%012d.raw' }
init-frames: 4395.999ms
ffmpeg-concat: 4496.324ms
concat error Error: failed to create OpenGL context
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/context.js:22:11)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/render-frames.js:19:21)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/index.js:47:32)
at
(node:5372) UnhandledPromiseRejectionWarning: Error: failed to create OpenGL context
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/context.js:22:11)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/render-frames.js:19:21)
at module.exports (/usr/lib/node_modules/ffmpeg-concat/lib/index.js:47:32)
at
(node:5372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:5372) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Does not properly escape filenames

This tool fails with filenames with shell special characters like spaces, since it just concats the filenames to a shell command. You could probably fix this by using some exec() function to make the arguments explicit (I'm not that great at nodejs so I'm not sure which exact package/function is best).

Error when trying to use the module

I am trying to type in my terminal ffmpeg-concat -t circleopen -d 750 -o huzzah.mp4 1.mp4 2.mp4 but got this error

node: symbol lookup error: ~/.nvm/versions/node/v11.0.0/lib/node_modules/ffmpeg-concat/node_modules/gl/build/Release/webgl.node: undefined symbol: _Z15XextFindDisplayP15_XExtensionInfoP9_XDisplay

How to solve it?
I am using ubuntu

extract-video-frames doesn't respect logger

in init-frames it is call

await extractVideoFrames({
    log,
    videoPath: scene.video,
    framePattern
  })

but in extract it uses .on('start', (cmd) => console.log({ cmd })) and opts doesn't have a default

UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory

I switched from raw format to png and here jpg, but I'm getting the same error:

ffmpeg-concat -f jpg -t circleopen -d 750 -o huzzah.mp4 condensed.mp4 SmallSampleVideo.mp4 (node:31972) ExperimentalWarning: The fs.promises API is experimental { cmd: 'ffmpeg -i SmallSampleVideo.mp4 -y -pix_fmt rgba -start_number 0 /private/var/folders/8v/78p3z4qj6tg78fs3z39220_m0000gn/T/d7ab0bc5d740fbd132ebddff4707cc49/scene-1-%012d.jpg' } { cmd: 'ffmpeg -i condensed.mp4 -y -pix_fmt rgba -start_number 0 /private/var/folders/8v/78p3z4qj6tg78fs3z39220_m0000gn/T/d7ab0bc5d740fbd132ebddff4707cc49/scene-0-%012d.jpg' } init-frames: 3285.974ms concat error { Error: ENOENT: no such file or directory, open '/private/var/folders/8v/78p3z4qj6tg78fs3z39220_m0000gn/T/d7ab0bc5d740fbd132ebddff4707cc49/scene-1-000000000NaN.jpg' errno: -2, code: 'ENOENT', syscall: 'open', path: '/private/var/folders/8v/78p3z4qj6tg78fs3z39220_m0000gn/T/d7ab0bc5d740fbd132ebddff4707cc49/scene-1-000000000NaN.jpg' } (node:31972) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/private/var/folders/8v/78p3z4qj6tg78fs3z39220_m0000gn/T/d7ab0bc5d740fbd132ebddff4707cc49/scene-1-000000000NaN.jpg' (node:31972) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:31972) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
node -v v10.1.0

Output broken when using looped image

Hello,
I'm converting an image to video using ffmpeg and when I try to use that video with ffmpeg-concat the output where the image is, is black.

npx ffmpeg-concat -o out-fc.mp4 1.mp4 2.mp4 3.mp4

When I use a regular ffmpeg concatenation then the output is ok

ls -1 1.mp4 2.mp4 3.mp4 | 
awk '{ print "file",$1}' | 
ffmpeg -y \
  -f concat \
  -safe 0 \
  -protocol_whitelist "pipe,file" \
  -i - \
  -c copy \
  out-f.mp4

Assets:
https://www.filehosting.org/file/details/823336/1.mp4
https://www.filehosting.org/file/details/823339/2.mp4
https://www.filehosting.org/file/details/823340/3.mp4

Error during process

I am getting the following error. It makes the /tmp folder full of raw files then deletes it but doesn't work...

   'ffmpeg -i 1572676384712.mp4 -y -pix_fmt rgba -start_number 0 /tmp/bdc1a01d2af4e692f7bddc531f4be320/scene-0-%012d.raw' }
{ cmd:
   'ffmpeg -i 1572676446286.mp4 -y -pix_fmt rgba -start_number 0 /tmp/bdc1a01d2af4e692f7bddc531f4be320/scene-1-%012d.raw' }
init-frames: 7154.286ms
render-frames: 180.134ms
ffmpeg-concat: 8180.844ms
(node:11988) UnhandledPromiseRejectionWarning: Error: ffmpeg exited with code 1: /tmp/bdc1a01d2af4e692f7bddc531f4be320/%012d.raw: No such file or directory

    at ChildProcess.<anonymous> (/home/ct/Dev/ffmpeg/node-streamlink/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:182:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
(node:11988) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11988) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

ffmpeg-concat CLI stops with syntax error

I ran the "npm install -g ffmpeg-concat" without error on my Linux Mint 17 system and then tried running the example ffmpeg-concat command with local files and got the following:

ffmpeg-concat -t circleopen -d 1000 -o test.wmv TOV.wmv TOV2.wmv
/home/gtaylor/.nvm/versions/node/v6.10.2/lib/node_modules/ffmpeg-concat/lib/index.js:12
module.exports = async (opts) => {
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/gtaylor/.nvm/versions/node/v6.10.2/lib/node_modules/ffmpeg-concat/index.js:4:18)

concat source audio

Currently, we only support concatenating videos with a single audio track specified for the output. We should support concatenating the input audio streams as well, defaulting to a cross-fade between audio streams during transitions.

Duration of 700 ms not working

I am trying to apply transition on bunch of videos. When I use 1000 ms as transition duration, it succeeds.
ffmpeg-concat -t 'Angular' -d 1000 -o final.mp4 1.mp4 2.mp4 3.mp4 4.mp4 5.mp4 6.mp4 7.mp4 8.mp4
ffmpeg-concat -t 'Fade' -d 1000 -o final.mp4 1.mp4 2.mp4 3.mp4 4.mp4 5.mp4 6.mp4 7.mp4 8.mp4

But when using 700 ms, it fails.
ffmpeg-concat -t 'Angular' -d 700 -o final.mp4 1.mp4 2.mp4 3.mp4 4.mp4 5.mp4 6.mp4 7.mp4 8.mp4
ffmpeg-concat -t 'Fade' -d 700 -o final.mp4 1.mp4 2.mp4 3.mp4 4.mp4 5.mp4 6.mp4 7.mp4 8.mp4

Error -
concat error Error: ffmpeg exited with code 69: Conversion failed!

at ChildProcess.<anonymous> (/usr/local/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
at ChildProcess.emit (events.js:182:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)

(node:16531) UnhandledPromiseRejectionWarning: Error: ffmpeg exited with code 69: Conversion failed!

at ChildProcess.<anonymous> (/usr/local/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
at ChildProcess.emit (events.js:182:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)

(node:16531) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16531) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The videos are uploaded at location - https://drive.google.com/drive/folders/12jaWCvF7SzVHhnRAdGyRh1DPdOMhKKj9?usp=sharing

Thanks.

Is there a way to pass transition parameters to gl-transition?

I want to use directional transition, but in horizontal way (default is vertical). I tried following options:

  {
    "name": "directional",
    "duration": 500,
    "direction": [1, 0],
    "paramsTypes":{"direction":"vec2"},
    "defaultParams":{"direction":[1,0]},
    "params":{"direction":[1,0]}
  }

But the resulting video contains the default vertical direction ([0,1])

No audio output when using the CLI?

I tried out ffmpeg-concat CLI just now. I'm really happy with the video produced but there's no audio in it.

I see a feature in the API to which an audio file can be passed, but access to this seems unavailable in the CLI. I figured the CLI would use the videos' audio by default.

-temp-dir option does not work

Even if I pass --temp-dir /Volumes/Backup/ to the command, like so,

ffmpeg-concat -d 5000 --temp-dir /Volumes/Backup/ -o ~/Downloads/26b-45min.mp4  26B.mp4 26B.mp4 26B.mp4 26B.mp4

ffmpeg-contact still creates raw files inside macOS tmp folder

{ cmd:
   'ffmpeg -i 26B.mp4 -y -pix_fmt rgba -start_number 0 /private/var/folders/2g/td4j8pj91wb1dn3fszcxmq3h0000gn/T/5f61828e8cfca17b15f2ba8235e4d29b/scene-0-%012d.raw' }
{ cmd:
   'ffmpeg -i 26B.mp4 -y -pix_fmt rgba -start_number 0 /private/var/folders/2g/td4j8pj91wb1dn3fszcxmq3h0000gn/T/5f61828e8cfca17b15f2ba8235e4d29b/scene-1-%012d.raw' }
{ cmd:
   'ffmpeg -i 26B.mp4 -y -pix_fmt rgba -start_number 0 /private/var/folders/2g/td4j8pj91wb1dn3fszcxmq3h0000gn/T/5f61828e8cfca17b15f2ba8235e4d29b/scene-2-%012d.raw' }

Details

ffmpeg-concat: 1.0.9
macOS: 10.13.5 (17F77)

--

Thank you for creating this awesome product. Other workarounds for creating transition using ffmpeg are so convoluted. Love your solution.

ffmpeg issues invalid argument error

After upgrading node.js to 8.11.2, running ffmpeg-cat is now running two ffmpeg commands and then dying on the third call with an invalid argument error. I am seeing the same error running both on Linux Mint 17 and also on Windows 10. The temp directories are different, but the errors are the same. Here is the output from running on Linux:

ffmpeg-concat -t circleopen -d 1000 -o test.wmv /theVault/video/TOV.wmv /theVault/video/TOV2.wmv
{ cmd: 'ffmpeg -i /theVault/video/TOV.wmv -y -pix_fmt rgba -start_number 0 /tmp/3bf4f71398a2b4c30f4d3b29f758966d/scene-0-%012d.raw' }
{ cmd: 'ffmpeg -i /theVault/video/TOV2.wmv -y -pix_fmt rgba -start_number 0 /tmp/3bf4f71398a2b4c30f4d3b29f758966d/scene-1-%012d.raw' }
init-frames: 8067.804ms
render-frames: 3792.801ms
{ cmd: 'ffmpeg -framerate NaN -vcodec rawvideo -pixel_format rgba -video_size 320x240 -i /tmp/3bf4f71398a2b4c30f4d3b29f758966d/%012d.raw -y -hide_banner -map_metadata -1 -map_chapters -1 -c:v libx264 -profile:v main -preset medium -crf 20 -movflags faststart -pix_fmt yuv420p -r NaN test.wmv' }
concat error Error: ffmpeg exited with code 1: /tmp/3bf4f71398a2b4c30f4d3b29f758966d/%012d.raw: Invalid argument

at ChildProcess.<anonymous> (/home/gtaylor/.nvm/versions/node/v8.11.2/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

(node:3718) UnhandledPromiseRejectionWarning: Error: ffmpeg exited with code 1: /tmp/3bf4f71398a2b4c30f4d3b29f758966d/%012d.raw: Invalid argument

cant install

Hello i cannot install ffmpeg-concat on Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-51-generic x86_64)
full cli output:

root@vmi264345:~/node_modules# npm install -g ffmpeg-concat
npm WARN deprecated [email protected]: use String.prototype.padStart()
/usr/local/bin/ffmpeg-concat -> /usr/local/lib/node_modules/ffmpeg-concat/index.js

> [email protected] install /usr/local/lib/node_modules/ffmpeg-concat/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

ERR! sharp EACCES: permission denied, mkdir '/root/.npm'
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/page/install for required dependencies
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/ffmpeg-concat/node_modules/sharp/.n                                                                                                             ode-gyp"
make: Entering directory '/usr/local/lib/node_modules/ffmpeg-concat/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:25:10: fatal error: vips/vips8: No such file or directory
 #include <vips/vips8>
          ^~~~~~~~~~~~
compilation terminated.
sharp.target.mk:128: recipe for target 'Release/obj.target/sharp/src/common.o' failed
make: *** [Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/ffmpeg-concat/node_modules/sharp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/ffmpeg-concat/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.15.0-51-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/ffmpeg-concat/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/ffmpeg-concat/node_modules/sharp
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v4.0.0
gyp ERR! not ok
/usr/local/lib
└── (empty)

npm ERR! Linux 4.15.0-51-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "ffmpeg-concat"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node                                                                                                              install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script '(node install/libvips && node install/dll-copy && prebuild-install) || (node                                                                                                             -gyp rebuild && node install/dll-copy)'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sharp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sharp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sharp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/node_modules/npm-debug.log
npm ERR! code 1

issue with transitions not taking effect

It is not working on mac. I have installed command line version using command "npm install -g ffmpeg-concat".

Below are the details -
$ npm -version
6.1.0

$ node --version
v10.4.1

$ ffmpeg-concat -t fade -d 2000 -o final.mp4 output000.mp4 output001.mp4
{ cmd:
'ffmpeg -i output001.mp4 -y -pix_fmt rgba -start_number 0 /private/var/folders/d3/bl72wzrx2_x5pkk5whbv7hfh0000gn/T/05c93ea88e4cd0516b6ddece22f3542a/scene-1-%012d.raw' }
{ cmd:
'ffmpeg -i output000.mp4 -y -pix_fmt rgba -start_number 0 /private/var/folders/d3/bl72wzrx2_x5pkk5whbv7hfh0000gn/T/05c93ea88e4cd0516b6ddece22f3542a/scene-0-%012d.raw' }
init-frames: 182.500ms
render 0%
render-frames: 43.159ms
{ cmd:
'ffmpeg -framerate 0.2 -vcodec rawvideo -pixel_format rgba -video_size 720x406 -i /private/var/folders/d3/bl72wzrx2_x5pkk5whbv7hfh0000gn/T/05c93ea88e4cd0516b6ddece22f3542a/%012d.raw -y -hide_banner -map_metadata -1 -map_chapters -1 -c:v libx264 -profile:v main -preset medium -crf 20 -movflags faststart -pix_fmt yuv420p -r 0.2 final.mp4' }
transcode 30%
transcode-video: 170.710ms
ffmpeg-concat: 401.022ms
final.mp4

When I play final.mp4, I don't see the transitions. I have tried different transitions and none of it seems to work. Am I missing something?

tmp files remain after render failure

the lib creates a temp working space and then tries to:
initFrames
renderFrames
transcodeVideo
and then cleanup

if it fails somewhere in the middle (e.g. during renderFrames) the temp working space remains.
as the consumer has no way of controlling the name of the working dir or even to know what that was - this can be cause a crash in low disk scenarios.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.