[FFmpeg-user] ffmpeg-lambda-layer and concat protocol

mark at shazaml.com mark at shazaml.com
Wed Dec 18 18:44:52 EET 2019


I am using the ffmpeg-lambda-layer in the AWS Serverless Application
Repository published by Gojko Adzic:

https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us
-east-1:145266761615:applications~ffmpeg-lambda-layer

 

I want to concatenate multiple MP3 files together into a single audio file.
I have what I think is the correct command, but I am not sure how to
represent it in code so that it is formatted correctly for the lambda layer.

 

Here is the code sample. Any assistance is greatly appreciated:

 

  

  const childProcess = require('child_process');

 

  childProcess.spawnSync(

    '/opt/bin/ffmpeg',

    [

      '-i', `"concat:/tmp/a.mp3|/tmp/b.mp3|/tmp/c.mp3|/tmp/d.mp3"`,

      '-acodec',

      'copy',

      '/tmp/out.mp3'

    ],

    { stdio: "inherit" }

  );

 

 

 

ffmpeg docs: https://trac.ffmpeg.org/wiki/Concatenate#protocol

 

 

This is one Lambda function of multiple that makes up a Step Function state
machine.

 

The Lambda is throwing an exception: "ENOENT: no such file or directory,
open '/tmp/out.mp3'"

 

The output in CloudWatch is:

 

ffmpeg version 4.1.3-static https://johnvansickle.com/ffmpeg/ Copyright (c)
2000-2019 the FFmpeg developers

built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516

configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gmp --enable-gray --enable-libaom
--enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-librubberband --enable-libsoxr
--enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid
--enable-libzvbi --enable-libzimg

libavutil 56. 22.100 / 56. 22.100

libavcodec 58. 35.100 / 58. 35.100

libavformat 58. 20.100 / 58. 20.100

libavdevice 58. 5.100 / 58. 5.100

libavfilter 7. 40.101 / 7. 40.101

libswscale 5. 3.100 / 5. 3.100

libswresample 3. 3.100 / 3. 3.100

libpostproc 55. 3.100 / 55. 3.100

"concat:/tmp/a.mp3|/tmp/b.mp3|/tmp/c.mp3|/tmp/d.mp3": No such file or
directory

 

What is the correct way to pass this command to ffmpeg?

 

Thanks, 

 

Mark

 



More information about the ffmpeg-user mailing list