On Tue, May 24, 2022 at 15:50:27 +0800, Sendex Six wrote: > Thanks for your response, > > What is the formula, logic, or how to compute the file size from a video or > audio file? after encoding? > so that in the webpage we can set the content-length of video or audio
Only under very particular circumstances you can determine the file size beforehand. I would say these are: - raw formats/codecs with coonstant bitrates - some containers with constant muxrates. And in addition, it depends on the codec and the container. Uncompressed WAV e.g. is extremely predictable. If you manage to get a constant bitrate encoding and muximg, you might be able to determine the size of MP4 or MPEG-TS, but you would have to know about the muxing mechanisms and the overhead, and ffmpeg's settings influencing it. As Harald said, the Content-Length isn't necessary, but the receiving end (user/web browser) will not show the progress if it's missing. This may or may not be okay. For what you are trying to achieve, segmented streaming formats such as HLS were made for: You can segment on the fly, and each finalized segment's size is known to the receiving end. I guess you can also indicate an average bitrate and a duration beforehand, but in my experience it doesn't have to be corrent. Cheers, Moritz _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".