I'm trying to play video using openCV but it only show video without sound can you help me to resolve that please, Here is my code.
( I have a macOS Mojave version 10.14.6 )
import cv2
from ffpyplayer.player import MediaPlayer
video = cv2.VideoCapture('videos/nature.mp4')
player = MediaPlayer('videos/nature.mp4')
while True:
# read video frame by frame
isTrue, frame = video.read()
audio_frame, val = player.get_frame()
cv2.imshow('Video', frame)
if val != 'eof' and audio_frame is not None:
#audio
img, t = audio_frame
if cv2.waitKey(28) & 0xFF == ord('q'):
break
video.release()
cv2.destroyAllWindows()
I tried with ffpyplayer but i got this error on my macOS.
mugisha-MBP:openCV jclaude$ python3 read.py
Traceback (most recent call last):
File "/Users/Desktop/SCRIPT/openCV/read.py", line 5, in <module>
from ffpyplayer.player import MediaPlayer
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ffpyplayer/player/__init__.py", line 10, in <module>
from ffpyplayer.player.player import MediaPlayer
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ffpyplayer/player/player.cpython-39-darwin.so, 2): Symbol not found: _objc_opt_class
Referenced from: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ffpyplayer/player/../.dylibs/libSDL2-2.0.0.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libobjc.A.dylib
in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ffpyplayer/player/../.dylibs/libSDL2-2.0.0.dylib