Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to measure compressed video size #191

Closed
Zayn-Rekhi opened this issue Jan 3, 2023 · 3 comments
Closed

How to measure compressed video size #191

Zayn-Rekhi opened this issue Jan 3, 2023 · 3 comments

Comments

@Zayn-Rekhi
Copy link

Zayn-Rekhi commented Jan 3, 2023

How to measure compressed video size?

Hi guys, I really appreciate all of your video compression work. I cannot thank you guys enough. I was wondering how I can measure the size of my compressed video. Any help or suggestions would be greatly appreciated :) Thanks.

@YodaEmbedding
Copy link
Contributor

YodaEmbedding commented Jan 3, 2023

Two ways:

  • During runtime, generate a bitstream or file and check its size. This is non-differentiable.

  • During training, compute the differentiable rate via the method below.

    Just like with the VAE image compression models, the rate in bpp can be measured via the cross-entropy between the actual symbols and their "predicted" distributions. Whenever the predicted distribution matches, the bit cost for encoding that symbol is low. This is effectively a sum of the log-likelihoods. Since these models minimize loss = R + lambda D, you may find the calculation for rate R (measured in bpp) in the RateDistortionLoss class in examples/train_video.py.

Note: This question is best asked in Discussions.

@Zayn-Rekhi
Copy link
Author

I apologize for writing my question, I will make sure to write it in discussion moving forward. I liked your first suggestion and looking at the evaluation code I think that this has already been implemented. However, when I check the size of the binary file it is much, much smaller than the mp4 file produced by h265. Hence, I think I did something wrong. What could I have done wrong?

@YodaEmbedding
Copy link
Contributor

YodaEmbedding commented Jan 4, 2023

Perhaps one of these may help:
#190 (comment)
#190 (comment) (first bullet point)

@fracape fracape closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants