How to play audio with video in opencv?

I want to play audio with video in opencv. I am using opencv version 4.5.5. According to {Reference link}, it seems that opencv-4.5.5 can play audio with video.
Is there any sample code that can run audio alongside video in opencv.

I have followed offical opencv video on youtube: link, but unable to run audio with opencv.

then you got the wrong library.
this is about computer-vision, not about multi-media.
there’s no general support for reading, playing or synchronizing audio and video

(as of 4.5.5, the MSMF webcam capture (only on win) can read audio streams (microphone), but there’s no “player” for it, it was added in the context of speech recognition)

1 Like

Thanks for clarification @berak. Then, I will try other modules like ff-mpeg etc.

Just to mention this to anyone looking to read Audio and Video at the same time from webcam/file. Here’s a sample/example that may help you: https://github.com/opencv/opencv/blob/4.x/samples/cpp/videocapture_audio_combination.cpp

1 Like

Thank you for answer. But is it possible to read audio via Python? It seems this method doesn’t work in Python.