can write video but the video can not be play
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 1k
- Avg merge
- 22h 17m
- Merged PRs (30d)
- 3
Description
Expected behaviour
can write and play video with sound using opencv
Actual behaviour
can write video using opencv
but the video can not be play
using IPython.display.video()
Steps to reproduce
!wget -c http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
pip install -U opencv-python
-
environment
google colab -
example code taken from https://docs.opencv.org/4.x/dd/d43/tutorial_py_video_display.html
already try to change the fourcc parameter into :
DIVX, XVID, MJPG, X264, WMV1, WMV2,
but still got the same result
import numpy as np
import cv2 as cv
import IPython
cap = cv.VideoCapture('BigBuckBunny.mp4')
# Define the codec and create VideoWriter object
fourcc = cv.VideoWriter_fourcc(*'XVID')
out = cv.VideoWriter('output.avi', fourcc, 20.0, (640, 480))
while cap.isOpened():
ret, frame = cap.read()
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
out.write(frame)
if cv.waitKey(1) == ord('q'):
break
# Release everything if job is finished
cap.release()
out.release()
cv.destroyAllWindows()
IPython.display.Video('output.avi', embed = True)
-
operating system
ubuntu jammy -
architecture (e.g. x86)
x86_64 -
opencv-python version
4.9.0.80 -
screenshot
Issue submission checklist
- This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
- I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
- The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
- I'm using the latest version of
opencv-python
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided code in Google Colab with opencv-python 4.9.0.80 and IPython.display.Video, using BigBuckBunny.mp4 and the listed codecs. Determine whether the failure is specific to the pre-built package or to the Colab playback environment; done means documenting a reproducible build-toolchain issue with evidence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100