Comments (10)
Hi @nsesh how are you?
Let me put a summary I saw on FFmpeg docs:
- 4:4:4: There is no chroma subsampling
- 4:2:2: Cb' and Cr' are sampled at half the sample rate of luma, the horizontal chroma resolution is halved
- 4:2:0: Cb' and Cr' are each subsampled at a factor of two, both horizontally and vertically
And the Wiki's drawing:
Both might help you to visualize the difference.
from digital_video_introduction.
@leandromoreira, thanks so much. The above pic and python view of single frame help me to understand the mistake I did.
For 4:2:0
'Y' pixels = 1280x720x8 bits
CbCr pixels = 640x360x8 bits + 640x360x8 bits
Total Bytes = 139GBytes (~50%)
For 4:2:2
Y pixels = 1280x720x8 bits
CbCr pixels = 640x720x8 bits + 640x720x8 bits
Total Bytes = 185GBytes (~66%)
Once again thanks very much for clearly explaining.
from digital_video_introduction.
got understanding from above diagram and hence closing this issue. Once again thanks very much.
from digital_video_introduction.
I'll leave this open as it can help other people!
from digital_video_introduction.
I hope it can help you to understand @nsesh
from digital_video_introduction.
@leandromoreira, thanks for your reply. Yes, if you see in the diagram you shared, it is clear that for 4:2:0, both horizontal and vertical resolution are half. Hence, in my calculation the resolution for CbCr was halved i.e. 640x360. In case of 4:2:2, I kept it as 640x720.
Hence, wanted to clarify if my understanding is correct and my calculation of file is correct or not.
As per the section "Chroma Subsampling", it is mentioned 12bits for 4:2:0 and file size is mentioned half of original size. We can't just sum up the ratio's and say that file size is half of original. In fact for 4:2:0, the average bits are 10 and not 12. Hence this confusion, but please correct me if I'm still wrong :)
from digital_video_introduction.
It's really hard because it's conceptual, and the mapping examples given are only theoretical and for illustration.
But to calculate required bandwidth factor relative to 4:4:4, one needs to sum all the factors and divide the result by 12.
- 4:2:0 = 6/12 = 0.5 = 50%
- 4:2:2 = 8/12 = 0.666 = 66.66%
Let's try to put it to test.
# cut a small chunk of video
ffmpeg -i small_bunny_1080p_60fps.mp4 -t 00:00:02 2s.mp4
# Now let's generate rawvideo format with each of the proper format
ffmpeg -i 2s.mp4 -c:v rawvideo -pix_fmt yuv444p yuv444p.yuv
ffmpeg -i 2s.mp4 -c:v rawvideo -pix_fmt yuv420p yuv420p.yuv
ffmpeg -i 2s.mp4 -c:v rawvideo -pix_fmt yuv422p yuv422p.yuv
ls -lah *yuv
-rw-r--r-- 1 leandro.moreira wheel 356M Apr 28 23:19 yuv420p.yuv
-rw-r--r-- 1 leandro.moreira wheel 475M Apr 28 23:21 yuv422p.yuv
-rw-r--r-- 1 leandro.moreira wheel 712M Apr 28 23:20 yuv444p.yuv
712M = 100%
356M = 50%
475M = 66.6%
from digital_video_introduction.
A python view of a single frame can be seen as:
# A single frame in KB
# full cr and cb (4:4:4)
y_plane = 1280*720*8
cr_plane = 1280*720*8
cb_plane = 1280*720*8
print((y_plane+cr_plane+cb_plane) / 8 / 1024)
# half cr and cb (4:2:0)
y_plane = 1280*720*8
cr_plane = 640*360*8
cb_plane = 640*360*8
print((y_plane+cr_plane+cb_plane) / 8 / 1024)
from digital_video_introduction.
- 4:2:0 - For each 4 pixes in Y we have only 1 for Cb and 1 for Cr = 6 pixels ( where it should be 4+4+4)
- 4:2:2 - For each 4 pixes in Y we have only 2 for Cb and 2 for Cr = 8 pixels (where it should be 4+4+4)
from digital_video_introduction.
@leandromoreira, just want to understand on 4:1:1
Y pixels = 1280x720x8 bits
CbCr pixels = 320x720x8 bits + 320x720x8 bits
Total Bytes = 139GBytes (50%).
Is my understanding correct?
If you can get the similar picture as explained above that will be helpful.
from digital_video_introduction.
Related Issues (20)
- Generate debug video Example doesn't run HOT 5
- Possible mistake with H.264 profile HOT 1
- Operation not permitted when triggering ./setup.sh HOT 2
- Permission denied while trying to connect to Docker Daemon socket during ./setup.sh HOT 1
- Needed more descriptive steps for running Jupyter example HOT 2
- /files/v/bunny_1080p_60fps.mp4: No such file or directory HOT 4
- ffmpeg examples: images were not generated from video HOT 2
- I suggest specifying tag of docker image `jupyter/scipy-notebook` because `scipy.misc.bytescale` method does not exists. HOT 2
- Change image colors in arithmetic coding section HOT 1
- Update colors of images to fall within WCAG guidelines HOT 1
- A bunch of broken links in the Miscellaneous section HOT 1
- Question regarding "2nd Step - predictions" HOT 4
- Spanish Translation HOT 3
- Block motion compensation coordinates typo.
- Please add VideoDubber.ai for AI Video Translation
- Minimalist Adaptive Streaming HOT 1
- Minimalist Adaptive Streaming for Video HOT 1
- P-Frame section - Typo? HOT 4
- Russian translation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from digital_video_introduction.