Commit 243541e
fix(nodes): pass display resolution to VA-API encoders (fixes #292)
The AV1 encoder was passing only the superblock-aligned coded resolution
to cros-codecs, which set render_width/render_height in the AV1 frame
header to the coded dimensions. For non-aligned inputs (e.g. 1280×720
→ coded 1280×768), decoders would show 48 pixels of black padding at
the bottom.
Add a display_resolution field to the vendored cros-codecs AV1
EncoderConfig and use it for render_width/render_height in the frame
header predictor. When display differs from coded dimensions, the AV1
bitstream now signals render_and_frame_size_different=1 so decoders
crop the superblock padding.
For H.264, the SpsBuilder::resolution() method already handles
macroblock alignment and frame_crop offsets automatically, but we were
passing the pre-aligned coded resolution, bypassing the cropping logic.
Now we pass the original display resolution and let SpsBuilder compute
the correct frame_crop offsets.
Closes #292
Signed-off-by: StreamKit Devin <devin@streamkit.dev>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>1 parent a469a46 commit 243541e
File tree
4 files changed
+29
-3
lines changed- crates/nodes/src/video
- vendor/cros-codecs/src/encoder
- stateless/av1
4 files changed
+29
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
973 | 973 | | |
974 | 974 | | |
975 | 975 | | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
976 | 985 | | |
977 | 986 | | |
978 | 987 | | |
979 | 988 | | |
| 989 | + | |
980 | 990 | | |
981 | 991 | | |
982 | 992 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
737 | 737 | | |
738 | 738 | | |
739 | 739 | | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
740 | 743 | | |
741 | | - | |
| 744 | + | |
742 | 745 | | |
743 | 746 | | |
744 | 747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
139 | 147 | | |
140 | 148 | | |
141 | 149 | | |
| |||
213 | 221 | | |
214 | 222 | | |
215 | 223 | | |
216 | | - | |
217 | | - | |
| 224 | + | |
| 225 | + | |
218 | 226 | | |
219 | 227 | | |
220 | 228 | | |
| |||
0 commit comments