On Thu, 2010-07-29 at 17:04 -0700, Sandeep Davu wrote: > Hi, > > I am downgrading the bitrate of mp3 files. Is there a way to find out the > file size of the converted file before actually converting the audio file. > > I wanted to convert a 320 kbps mp3 file to a 64 kbps mp3 file and send it > over the wire using http. > For this I need the content-length filed which is the size of the converted > file. > I preserved the sampling rate and number of channels of the original file. > > Is this formula corrext > inputFormatContext->duration * outputCodecCtx->birate (given that the number > of channels are same) > > for some files this formula works, but not for all the files. > Is there a more accurate way to calculate the file size beforehand. > > Sandeep.
Why not send the file using chunked encoding like libavformat's http protocol does? That way you don't need to know the size of the file. If you're serving the file instead, then you could simply choose not to specify the content-length - just stream it out. The user can't seek anyway. /Tomas
signature.asc
Description: This is a digitally signed message part
_______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
