Use Case
When a user records an audio file and uploads to firebase storage, run a trigger that crops a clip of that file and saves it to a "preview" directory.
Problem
Getting Output file #0 does not contain any stream after static .AAC file is downloaded to temp directory and ffmpeg command is run.
Environment
- mac client / firebase storage
- node v8.1.0
- ffmpeg v3.2.2
- fluent-ffmpeg v2.1.2
Node Code
var command = new ffmpeg({ source: tempFilePath, timeout: 0 }) .setFfmpegPath(ffmpegPath) .setFfprobePath(ffprobePath) .inputOption('-t', '10') .inputOption('-ss', '10') .outputOption('-acodec', 'copy') .on('start', function(commandLine) { console.log('Spawned Ffmpeg with command: ', commandLine); }) .on('end', function() { console.log('Preview file cropping done successfully'); }) .on('error', function(err, stdout, stderr) { var build = err; if (!stdout === '') { build = build + '\n' + stdout; } build = build + '\n' + stderr; console.log(build); }).save(tempFilePath);
Ffmpeg Command
Spawned Ffmpeg with command: ffmpeg -t 10 -ss 10 -i /tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac -y -acodec copy /tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac
Debug Output From Firebase
Error: ffmpeg exited with code 1: Output #0, adts, to '/tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac': Output file #0 does not contain any stream
ffmpeg version 3.2.2-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.1 (Debian 5.4.1-4) 20161202 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 [aac @ 0x3a00e60] Format aac detected only with low score of 1, misdetection possible! [aac @ 0x3a00e60] Could not find codec parameters for stream 0 (Audio: aac, 0 channels, fltp): unspecified sample rate Consider increasing the value for the 'analyzeduration' and 'probesize' options /tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac: could not seek to position 10.000 Input #0, aac, from '/tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac':
Duration: N/A, bitrate: N/A Stream #0:0: Audio: aac, 0 channels, fltp Output #0, adts, to '/tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac': Output file #0 does not contain any stream
Console Output
| $ ffmpeg -t 10 -ss 10 -i 2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac -y -acodec aac output_file.aac
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers built with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 [aac @ 0x7fac6c800a00] Estimating duration from bitrate, this may be inaccurate Input #0, aac, from '2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac': Duration: 00:01:07.71, bitrate: 223 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 277 kb/s Output #0, adts, to 'output_file.aac': Metadata: encoder : Lavf57.56.100 Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc57.64.101 aac Stream mapping: Stream #0:0 -> #0:0 (aac (native) -> aac (native)) Press [q] to stop, [?] for help size= 159kB time=00:00:10.00 bitrate= 130.5kbits/s speed=12.7x video:0kB audio:156kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.887004% [aac @ 0x7fac6d004600] Qavg: 383.548
Comments & Observations
I am able to run the ffmpeg command (provided above) locally and get the results I want.
I do some additional file manipulation before uploading to the remote:
var previewFileName = PREVIEW_PREFIX + fileName;
var previewFilePath = path.join('previewFiles', previewFileName);
//Uploading the preview file.
return bucket.upload(tempFilePath, {destination: previewFilePath});The origin file is AAC. I have verified that it is, indeed, an AAC file and not a different file type masquerading as an AAC.
The output file format appears as audio/x-aac in firebase. I would expect it to be the same as the origin file - audio/aac.