Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,17 @@ You can try our code example:
pip install "trame-rca[vtkstreaming]"

python ./examples/05_video/vtk_cone_simple_video.py

In order to use source-build of vtkstreaming, please clone [VTKStreaming](https://github.com/Kitware/VTKStreaming.git) one level
up outside the trame-rca directory, checkout the `wheel` branch, and install it inside the trame-rca virtual environment

.. code-block:: console

cd ..
git clone https://github.com/Kitware/VTKStreaming.git
cd VTKstreaming
uv pip install --group dev # build deps into active venv; index from tool.uv.index
uv pip install -e . --no-build-isolation
cd ../trame-rca

python ./examples/05_video/vtk_cone_simple_video.py
9 changes: 1 addition & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,9 @@ turbo = [
]
vtkstreaming = [
"vtk",
"vtk-streaming>=0.3.2",
"vtk-streaming>=0.3.4",
]








[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Expand Down
5 changes: 2 additions & 3 deletions src/trame_rca/encoders/video_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _set_size(self, render_window_size: tuple[int]):
def _initialize(self, render_window: vtkRenderWindow):
self.encoder.SetGraphicsContext(render_window)
self.encoder.SetInputPixelFormat(VTKPF_IYUV)
self.encoder.SetBitRateControlMode(3) # Constant quantization
self.encoder.SetBitRateControlMode(vtkVideoEncoder.BRCType.CQP)
self.encoder.SetQuantizationParameter(5) # 0 (high quality) - 63 (low quality)

self.frame = vtkOpenGLVideoFrame()
Expand Down Expand Up @@ -115,8 +115,7 @@ def encode(self, render_window: vtkRenderWindow):
if self.encoder is None or self.frame is None:
return
if self._window_size != render_window.GetSize():
# Ideally we would just call _set_size here
self._reset(render_window)
self._set_size(render_window_size=render_window.size)
self.frame.Capture(render_window)
self.encoder.Encode(self.frame)

Expand Down
Loading