Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can write video but the video can not be play #951

Open
4 tasks done
sugizo opened this issue Feb 4, 2024 · 0 comments
Open
4 tasks done

can write video but the video can not be play #951

sugizo opened this issue Feb 4, 2024 · 0 comments

Comments

@sugizo
Copy link

sugizo commented Feb 4, 2024

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
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
    image

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant