diff --git a/crates/pyrowave-sys/vendor/pyrowave/encode.cpp b/crates/pyrowave-sys/vendor/pyrowave/encode.cpp index 95725551..2e78fada 100644 --- a/crates/pyrowave-sys/vendor/pyrowave/encode.cpp +++ b/crates/pyrowave-sys/vendor/pyrowave/encode.cpp @@ -201,7 +201,10 @@ static void run_encoder(Device &device, const char *out_path, const char *in_pat for (auto &img : inputs.images) { auto *y = cmd->update_image(*img); - if (!input.read(y, img->get_width() * img->get_height())) + // PUNKTFUNK PATCH 0003: size the plane read in BYTES, not texels — 16-bit y4m + // inputs otherwise read half a plane and desync the stream after frame 1. + if (!input.read(y, size_t(img->get_width()) * img->get_height() * + YUV4MPEGFile::format_to_bytes_per_component(input.get_format()))) { LOGE("Failed to read plane.\n"); device.submit_discard(cmd);