shamaleyte
shamaleyte

Reputation: 1912

ffmpeg limit the size of transcoded output as <104857600 bytes

I am converting the video.webm into .wav file with the following options. However the output file is just pretty huge!

I need to reduce the size of it, actually it would be really cool to limit the output size as 104857600 bytes and let the ffmpeg library handle the rest (like automatically adjust the quality) Any idea how to do that?

If that is not possible, how can I lower the quality like 50% ?

return new Promise(function (resolve, reject) { 
    var proc = new ffmpeg({
        source: file,
        nolog: false
    });



   proc.addOptions([
        '-f ' + format,
        '-ar 16000',
        '-vn'
    ]);

    proc.on('error', function (err, stdout, stderr) {
        reject(err)          
    });
    proc.save(file.split(".")[0] + "." + format).on('end', function () {            
        resolve(file.split(".")[0] + "." + format);
    })
});

Upvotes: 1

Views: 652

Answers (1)

osgx
osgx

Reputation: 94175

WAV files are usually uncompressed (but there are some options) - there is no any quality to change after the PCM sampling rate + mono/stereo + bits per sample are selected (they are globally static for the WAV, probably for the full file) - https://en.wikipedia.org/wiki/WAV#WAV_file_audio_coding_formats_compared

Check output of your ffmpeg -encoders option and docs: https://www.ffmpeg.org/ffmpeg-codecs.html#Encoders to find some Audio Encoder with compression.

Upvotes: 1

Related Questions