Peter Gien
2006-Sep-09 13:18 UTC
[Speex-dev] Optimal frame size to use for file compression?
Hi, I have raw PCM data that is 180 seconds long and sampled at 22050 samples per second. The data is 16-bit speech audio, male and female voices. My question is: What is a good frame size to use if I capture the entire audio stream first and then want to compress it for later playback. I noticed that the example encoder code calls: speex_bits_init(&bits); and I notice that this has the following memory allocation: bits->bytes = (char*)speex_alloc(MAX_BYTES_PER_FRAME); bits->buf_size = MAX_BYTES_PER_FRAME; Somewhere else I noticed that MAX_BYTES_PER_FRAME is #defined to be 2000. So I think the maximum practical value for a frame size is around 1000 samples although we could go higher if we could predict the compression. So what is a good practical value for FRAME_SIZE with my application parameters? I need good compression and good performance. SInce these are usually opposing goals, I'll settle for something in the middle Thanks in advance. (BTW, Speex is a gem.) Peter
Jonas Tärnström
2006-Sep-09 16:03 UTC
SV: [Speex-dev] Optimal frame size to use for file compression?
22050 hz is not optimal for a codec intended for 8000 (narrow band), 16000 (wide band) or 32000 (ultra wideband). Depending on the quality needs for your specific implementation I would pick one of the above modes and feed the codec 160, 320 or 640 samples of the total stream each call to speex_encode. AFAIK the frame size is hard coded for each speex encoder mode. The documentation should clear this out for you. //Regards JT -----Ursprungligt meddelande----- Fr?n: speex-dev-bounces@xiph.org [mailto:speex-dev-bounces@xiph.org] F?r Peter Gien Skickat: den 9 september 2006 22:15 Till: speex-dev@xiph.org ?mne: [Speex-dev] Optimal frame size to use for file compression? Hi, I have raw PCM data that is 180 seconds long and sampled at 22050 samples per second. The data is 16-bit speech audio, male and female voices. My question is: What is a good frame size to use if I capture the entire audio stream first and then want to compress it for later playback. I noticed that the example encoder code calls: speex_bits_init(&bits); and I notice that this has the following memory allocation: bits->bytes = (char*)speex_alloc(MAX_BYTES_PER_FRAME); bits->buf_size = MAX_BYTES_PER_FRAME; Somewhere else I noticed that MAX_BYTES_PER_FRAME is #defined to be 2000. So I think the maximum practical value for a frame size is around 1000 samples although we could go higher if we could predict the compression. So what is a good practical value for FRAME_SIZE with my application parameters? I need good compression and good performance. SInce these are usually opposing goals, I'll settle for something in the middle Thanks in advance. (BTW, Speex is a gem.) Peter _______________________________________________ Speex-dev mailing list Speex-dev@xiph.org http://lists.xiph.org/mailman/listinfo/speex-dev