2013-12-23 54 views
3

我使用fluent-ffmpeg模塊來轉換音頻文件。我有我想要一個MP3播放文件轉換爲.WMAFluent-ffmpeg「不是一個合適的輸出格式」

這裏是什麼樣子:

var proc = new ffmpeg({ 
    source: 'file.mp3', 
    nolog: false 
}).toFormat('wma')             
    .saveToFile('file.wma', function(stdout, stderr) 
{             
    console.log(stderr); 
}); 

不幸的是,我得到的錯誤:

Requested output format 'wma' is not a suitable output format 

這是整個錯誤日誌:

ffmpeg version 0.8.9-4:0.8.9-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers 
    built on Nov 9 2013 19:25:10 with gcc 4.6.3 
*** THIS PROGRAM IS DEPRECATED *** 
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead. 
Input #0, mp3, from 'song_downloads/You Suffer.mp3': 
    Metadata: 
    title   : You Suffer 
    artist   : Napalm Death 
    album   : Scum 
    genre   : Death Metal 
    track   : 12 
    date   : 1987 
    Duration: 00:00:04.98, start: 0.000000, bitrate: 381 kb/s 
    Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 193 kb/s 
Requested output format 'wma' is not a suitable output format 

我知道這是不是一個ffmpeg的問題,因爲

ffmpeg -i file.mp3 file.wma 

工作正常。有任何想法嗎?

+0

嘗試'wma'不'.wma'。 – user568109

+0

對不起,我就是這麼做的。只是複製它錯了。 – Harangue

回答

4

我想,wma不是容器格式。它是一個音頻編解碼器。 WMA文件通常以ASF(高級系統格式)格式包含。因此,請選擇fluent-ffmpeg API中提供的正確選項來設置編解碼器和格式。您可以運行這些命令:

  1. ffmpeg -formats看到所有格式和

  2. ffmpeg -codecs看到所有支持的編解碼

+0

這並不能解釋爲什麼它在命令行中成功轉換。 – Harangue

+2

@ J4g命令行根據用戶輸入設置適當的選項(如設置常用文件的編解碼器和格式)。我的猜測是流暢的API映射到冗長的選項(以-vcodec -acodec開頭)。因此,從命令行發生的選項自動設置不會通過fluent-ffmpeg發生。 – user568109

+0

感謝您的幫助! – Harangue

0

這個工作對我來說罰款

fluent_ffmpeg('input.mp3').audioCodec("aac").save('output.aac')

wh。

wh恩格式爲: D aac raw ADTS AAC (Advanced Audio Coding)

不是E =木星支持