5

I'm struggling for several days to find a proper solution and it seems that nowhere on the Internet is my solution.

Long story short: I have a CCTV camera that transmits a RTSP stream. I want to capture that in a .mp4 format (other video format is ok, too) including AUDIO(I have a microphone for each camera).

All the solution from the internet came without audio and saving frame by frame I fell it is not a cool solution.

I've tried different solutions: OpenCV, VLC even FFmpeg but the sleekest solution is with VLC python package like this:

RTSP_LINK = r'rtsp://ip_camera:554/user=my_user&password=my_password&channel=1&stream=0.sdp?real_stream--rtp-caching=100'

import vlc
import time
player=vlc.MediaPlayer(RTSP_LINK)
player.play()

count = 0

while count <= 100:
    count = count + 1
    time.sleep(0.2)
    player.video_set_scale(1.5)
    player.video_take_snapshot(0, './images/snapshot{0}.tmp.png'.format(count), 1920, 1080)

I can see the stream with audio, but I can only save frame by frame.

The question is: Can I, somehow, save the video with VLC(or other Python packages) including audio?

Thanks!

DBL
  • 149
  • 8

0 Answers0