0

Trying to use '-acodec libopus' in my npm project as I use in the command line like in the following format;

ffmpeg -acodec libopus -i 1.webm 1.wav

This works perfectly! But I would like to make it possible in my NPM project.

How can I set the parameters? This is what I have , but not working. The output file is broken in a way that some of the frames of the audio file are missing. It is like there is sound and then there is not. And vice versa.

var proc = new ffmpeg({
        source: file,
        nolog: false       
    });


format = "opus"; // or could be wav as well!   


    proc.addOptions([
        '-f ' + format,          
        '-acodec libopus',
        '-vn'
    ]);

The purpose is to take audio file from the video file seamlessly.

Without the codec libopus, I get the following errors in the command prompt, so I assume I should handle the same issue in my NPM project as well.

[opus @ 00000000006d4520] LBRR frames is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.


[opus @ 00000000006d4520] Error decoding a SILK frame.

[opus @ 00000000006d4520] Error decoding an Opus frame.

My library is up to date, I just need to use the codec libopus properly. Any suggestions?

 \node-js>ffmpeg -version
 ffmpeg version N-86175-g64ea4d1 Copyright (c) 2000-2017 the FFmpeg 
 developers
 built with gcc 6.3.0 (GCC)

Output in command line;
xtranscribe transcodeWatson: file : ./data/that/2.webm
progress 62.625273103421605%
progress 100.01224534515762%
SAVED - transcodeWatson : .mp3
out of transcode!
fileSizeInBytes  : 16284033
4

1 回答 1

2

根据README您可以在流程中添加输入选项:

proc.addInputOption('-acodec libopus');

在 ffmpeg 中放置选项的位置很重要。如果你把它放在前面-i,它适用于那个特定的输入。如果将它放在输出文件名之前,它将应用于该输出。

于 2017-07-03T17:48:14.093 回答