[FFmpeg-user] Large Sized output files recieved while encoding the audio

Carl Zwanzig cpz at tuunq.com
Wed Apr 20 21:51:55 EEST 2022


Please stop top-posting.

On 4/20/2022 11:19 AM, Shubham Tiwari wrote:
> *behaviour: *executed within a second, input file size 2.1 mb, output file
> size 176 mb

Yep, 15 minutes at 48k samples/second is... 48000 * 60 * 15 = 43 million(!) 
samples. In 16 bit stereo at 4 bytes/sample, hmm, at least 173MB. Why? 
because you're outputting pcm format, which is the default for .wav files.

And it's right in the log-
   Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, 
s16, *1536 kb/s*
(emphasis added)

Don't want a big file? Use a different output codec. How? use "-f" to 
specify it (that's all in the doc and many web pages about ffmpeg) or use a 
different file extension.

> I went through the documentation but couldn't find any suitable way to fix
> it. 

"-f" on the output and a better choice of format. Is it really stereo 
content? Does it need to be? Could mix that to mono. Could drop the sample 
rate from 48k to 24k. If these are recordings of telephone calls, then 16k 
is more than enough (this should be implemented when the recording is made, 
not in later processing).

There are a lot of optimizations possible but it takes a greater 
understanding of the entire process (inputs, pipeline, and how the output is 
used) to properly attack this, with that much traffic simply adjusting one 
part is a bad engineering approach. As Bouke pretty much said, you need 
someone with experience in audio processing to analyze things and make 
recommendations.


You also have-
[opus @ 0x7f78d8009800] Too many errors when draining, this is a bug. Stop 
draining and force EOF.
Error while decoding stream #0:0: Internal bug, should not have happened

which might be cured by using a more recent ffmpeg build (which is 
recommended in the mailing list FAQ and is good practice in general).


_and_  to avoid confusion whatever is creating the files should be changed 
so the output files don't have a .wav extension-
"Opus was originally specified for encapsulation in Ogg containers, 
specified as audio/ogg; codecs=opus, and for Ogg Opus files the .opus 
filename extension is recommended. Opus streams are also supported in 
Matroska, WebM, MPEG-TS, and MP4."
https://en.wikipedia.org/wiki/Opus_(audio_format)



z!


More information about the ffmpeg-user mailing list