# Hiding log from OpenCV (Missing reference price, default is 0 | decode\_slice\_header error)

**URL:** <https://discourse.jupyter.org/t/hiding-log-from-opencv-missing-reference-price-default-is-0-decode-slice-header-error/20013>\
**Category:** Kernels\
**Tags:** how-to, help-wanted\
**Created:** [June 20, 2023, 4:35am UTC](https://discourse.jupyter.org/t/hiding-log-from-opencv-missing-reference-price-default-is-0-decode-slice-header-error/20013 "2023-06-20T04:35:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uysim\_Ty](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/uysim_ty/32/10245_2.png) [@Uysim\_Ty](https://discourse.jupyter.org/u/Uysim_Ty)\
**Post date:** [June 20, 2023, 4:35am UTC](https://discourse.jupyter.org/t/hiding-log-from-opencv-missing-reference-price-default-is-0-decode-slice-header-error/20013/1 "2023-06-20T04:35:14Z")

</div>

My cv2 code is printing the terminal message to the Jupyter

```auto
Missing reference picture, default is 0 
decode_slice_header error

```

I understand that the problem might be because of the video file but I just want to hide this message so I can export the a clean output from Jupyter to my client  
The log above seem not effect anything on my processing.

Sample of my code.

```auto
cap = cv2.VideoCapture(video_path)
cap.set(cv2.CAP_PROP_POS_FRAMES, frame_index)
ret, frame = cap.read()

```

I tried `capture` and `redirect_stdout`. But it seem to work with only print not the terminal.  
Honestly, I am not sure where is message come from whether the cv2 print it? or ffmpeg print it? or Jupyter capture it from terminal. But what I want to now is just hiding it.

Can someone suggest me the best approach for this?

---

<div class="post-metadata">

**Author:** ![minrk](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/minrk/32/13_2.png) [@minrk](https://discourse.jupyter.org/u/minrk)\
**Post date:** [August 9, 2023, 11:42am UTC](https://discourse.jupyter.org/t/hiding-log-from-opencv-missing-reference-price-default-is-0-decode-slice-header-error/20013/2 "2023-08-09T11:42:12Z")

</div>

You can disable IPython’s capture of low-level FD output in your `ipython_config.py`:

```auto
# ipython_config.py
c.IPKernelApp.capture_fd_output = False

```

More information and workarounds [in this issue](https://github.com/ipython/ipykernel/issues/795#issuecomment-976361904).

You can also use [wurlitzer](https://pypi.org/project/wurlitzer/), which captures low-level FD output, which can then be discarded:

```python
from wurlitzer import pipes

with pipes() as _discarded:
    cv2....

```
