Empty videos when loop recording
I have a NET Core service that implements the logic of the DVR. Service constantly record small videos in loop. Duration of video from 4 to 10 seconds. OS: Ubuntu 20, libvlc 3 and 4
_timer?.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
try
{
if (mediaPlayer.IsPlaying)
{
mediaPlayer.Stop();
media.Dispose();
}
media = new Media(libvlc, rtsp_url, FromType.FromLocation);
media.AddOption(":sout=#file{dst=" + _path + "/base/" + System.DateTime.Now.ToString("ddMMyyyyHHmmssfff") + ".ts}");
//media.AddOption(":no-sout-keep");
//media.AddOption(":rtsp-tcp");
mediaPlayer.Play(media);
}
catch (Exception err)
{
}
_timer.Change(_timelapse, _timelapse);
Some time after starting, i get empty videos (0 bytes) and property prev_midia.Statistics.DemuxReadBytes == 0. I tried dispose mediaPlayer
var toDispose = mediaPlayer;
Task.Run(() =>
{
toDispose?.Dispose();
});
and reinit LibVLC(), but video not recording. Restarting service solves the problem for a while
After migration on libvlc4 problem still exists but now i see error in console:
[00007f2ad404d4c0] live555 access error: Failed to connect with rtsp://192.168.2.88:554/av0_1
[00007f29e0fddb40] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[00007f2ad404d4c0] satip access error: Failed to connect to RTSP server 192.168.2.88:554
In vlc log i see such:
usbstream:CARD=PCH: HDA Intel PCH USB Stream Output
default: Default
using audio output module "alsa"
keeping audio output
Creating an input for 'rtsp://192.168.2.88/av0_1'
creating stream output chain `file{dst=/home/brix/kiosk/video/video/base/10122020001940863.ts}'
stream=`file'
looking for sout output module matching "file": 1 candidates
set config option: sout-standard-dst to /home/brix/kiosk/video/video/base/10122020001940863.ts
looking for sout access module matching "file": 1 candidates
file access output opened (/home/brix/kiosk/video/video/base/10122020001940863.ts)
using sout access module "file"
looking for sout mux module matching "ts": 1 candidates
shaping=200000 pcr=70000 dts_delay=400000
using sout mux module "mux_ts"
muxer support adding stream at any time
using `file/ts:///home/brix/kiosk/video/video/base/10122020001940863.ts'
using sout output module "stream_out_standard"
using timeshift granularity of 50 MiB
using default timeshift path
`rtsp://192.168.2.88/av0_1' gives access `rtsp' demux `any' path `192.168.2.88/av0_1'
creating access: rtsp://192.168.2.88/av0_1
looking for access module matching "rtsp": 2 candidates
version 2020.01.19
killing decoder fourcc `h264'
removing module "h264"
removing module "live555"
Program doesn't contain anymore ES
destroying useless sout
destroying chain(name=file)
removing module "stream_out_standard"
removing module "mux_ts"
removing module "file"
file access output closed
destroying chain done
Available ALSA PCM devices:
surround21: 2.1 Surround output to Front and Subwoofer speakers
surround40: 4.0 Surround output to Front and Rear speakers
surround41: 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50: 5.0 Surround output to Front, Center and Rear speakers
surround51: 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71: 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
null: Discard all samples (playback) or generate zero samples (capture)
samplerate: Rate Converter Plugin Using Samplerate Library
speexrate: Rate Converter Plugin Using Speex Resampler
jack: JACK Audio Connection Kit
oss: Open Sound System
pulse: PulseAudio Sound Server
upmix: Plugin for channel upmix (4,6,8)
```[vlc_log.log](/uploads/5b52c2b80ae3fc9e2d6b651bc4d16bd7/vlc_log.log)