问题
Is there any best practice to keep the size of the transcoded output file under a specific size?
I need to keep it under <100 MB but somehow I end up with big output files. The problem is that my (test) video file is 600kb while the generated output.wav 4MB. It is quite far away from what I expected.
var proc = new ffmpeg({
source: file,
nolog: false
});
proc.addInputOption('-acodec libopus');
format = "wav";
proc.addOptions([
'-f ' + format,
'-ab 192000',
'-ar 16000',
'-vn'
]);
This is how I gave the parameters to ffmpeg library. What parameters should I change here to reduce the size and keep the max. quality?
回答1:
Using WAV as output format makes ffmpeg choose uncompressed PCM audio, where bitrate settings have no effect. You may want to read this post: What is a Codec (e.g. DivX?), and how does it differ from a File Format (e.g. MPG)?
If you were using the command line, you'd just have to copy the audio stream to an output file without touching the bitstream (-c:a copy
):
ffmpeg -i input.webm -vn -c:a copy output.opus
In fluent-ffmpeg, I guess this is the way to go:
ffmpeg('input.webm')
.addInputOption('-acodec libopus')
.noVideo()
.audioCodec('copy')
.output('output.opus')
You can also webm
as output format by writing to output.webm
.
来源:https://stackoverflow.com/questions/44891840/fluent-ffmpeg-how-to-reduce-the-size-of-the-output-file-without-losing-any-sound