Record live streamed video from rtsp url

Hi, I am doing an android application. In my application I need to record live streamed video.And here I am using rtsp protocol and ffmpeg library to stream and record video.Live streaming is working properly, but video recording is not working. I think it’s a problem of URL Connection I am used here to record video.But I don’t know what is the correct connection method.I search lot about this, but can’t find anything. If anybody know this please help me.

HA does not record. View only(1 frame updated every 15 seconds)

For recording RTSP look at motion or motioneye (meant for security)
OR
Use ffmpeg output to file

This is how I did it, in linux:

HA configuration:

switch:
    - platform: command_line
    switches:
      webcam_recording_on_off:
        command_on:  <path-to-.homeassistant>/start_webcam_recording.sh &
        command_off: 'killall ffmpeg &'
        friendly_name: Webcam Recording

this is start_webcam_recordign.sh:

#!/bin/bash

killall ffmpeg
now=$(date +"%Y.%m.%d-%H_%M_%S");
ffmpeg -i  rtsp://<your-rtsp-url> -acodec copy -vcodec copy <path-to-.homeassistant>/www/$now-webcam.avi
2 Likes

Hi

do not work for me… Get

![image|690x77](upload://rWoKl8sZoNdqz2etUWEivLxgdwO.png) 

Works great for me. The only addition I added was:

command_state: 'ps -ef |grep -v grep |grep ffmpeg'

Which allows the switch to show an “on” status for when it’s recording.

it works for me, thank you