Skip to content

Extracating raw values of slices (I/P/B Slices) #1909

Closed Answered by kenwaytis
makisukurisu asked this question in 1. Help
Discussion options

You must be logged in to vote

I can explain the image format. Your original video is likely in yuv420p, where the memory layout typically places the complete Y plane first, followed by the U and V planes. Therefore, the array height becomes 1080 (Y) + 540 (U/V) = 1620, while the width remains the same as the Y plane's width, 1920.

If you want to obtain RGB or BGR, you can directly specify the frame's format, such as frame.to_ndarray(format='rgb24').

Regarding fetching I/P/B frames, it seems PyAV cannot specify decoding. If the goal is modification rather than precise retrieval, maybe consider decoding and then re-encoding?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@makisukurisu
Comment options

Answer selected by makisukurisu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants