Error while using GStream and OpenCV
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 1k
- Avg merge
- 22h 17m
- Merged PRs (30d)
- 3
Description
Expected behaviour
The idea is to use GStream with OpenCV to compress a video.
Actual behaviour
The code raises an error because of the pipeline
Steps to reproduce
- operating system: ubuntu 20.04
- opencv-python version 4.20
My code is:
`compressed_video_path = os.path.join(picture_path, f"{datetime.datetime.now()}.mp4")
gst_pipeline = (
f"appsrc format=GST_APP_FORMAT_TIME ! videoconvert ! x264enc ! mp4mux ! filesink location={compressed_video_path}"
)
recorded_video = cv2.VideoWriter(gst_pipeline,
cv2.CAP_GSTREAMER,
0,
self.camera_fps,
(self.frame_size[1], self.frame_size[0]))
if not recorded_video.isOpened():
raise ValueError("Error!!!")
for frame in frames_to_compress:
recorded_video.write(frame)
recorded_video.release()
rospy.loginfo(f"Compressed video saved in {compressed_video_path}.")`
And when calling the ros service involved, I have the error "Error!!!"
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 shown cv2.VideoWriter call on Ubuntu 20.04 with the stated opencv-python version and GStreamer pipeline. Check why recorded_video.isOpened() fails and compare the pipeline requirements with the packaged OpenCV build. Done means identifying the cause and documenting a verified compatible configuration or a clearly reproducible limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- opencv, python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100