Recording generating huge files

This forum is about all development around libVLC.
alhano
New Cone
New Cone
Posts: 2
Joined: 29 Jan 2018 16:26

Recording generating huge files

Postby alhano » 29 Jan 2018 17:27

Hi,

I need to develop an application that can record up to 10 rtsp streams coming from IP cameras to files.
I also need to be able to play this files while the recording updates them.
The VLC version is 2.2.6.

I have been trying different options strings passed to libvlc_media_add_option function.

std::ostringstream sStreamOption;

// Version 1

Code: Select all

sStreamOption << ":sout=#standard{access=file,mux=ts,dst=" << outputFile << "}";
// Version 2

Code: Select all

sStreamOption << ":sout=#file{dst=" << outputFile << "}";
// Code to start recording.

Code: Select all

_pInstance = libvlc_new (0, NULL); if (_pInstance != NULL) { _pMedia = libvlc_media_new_location (_pInstance, url.c_str ()); if (_pMedia != NULL) { libvlc_media_add_option (_pMedia, sStreamOption.str ().c_str ()); _pMediaPlayer = libvlc_media_player_new_from_media (_pMedia); if (_pMediaPlayer != NULL) libvlc_media_player_play (_pMediaPlayer); } }
This code will be ran in 1 thread for each stream.

When I use version 1 for the options, some of the streams are recorded properly, some of them generate huge file (it can reach a 1 GB very quickly), some others seems to be stopped. These huge files can't be played with any player.

When I use version 2 for the options, I have the same symptoms, plus the facts that I can't play the files while they are recording.

So I have the following questions :
- Can I execute this code from different threads?
- Which options do I need to pass to libvlc_media_add_option, knowing that no transcoding is needed?

Thanks for help!

chouquette
Developer
Developer
Posts: 291
Joined: 15 Apr 2010 00:54

Re: Recording generating huge files

Postby chouquette » 30 Jan 2018 13:53

Could you try with a more recent libvlc version? Depending on your OS you can find builds here: http://download.videolan.org/videolan/t ... 3.0.0-rc8/ or rebuild it yourself

It might at least help a bit with regards to playing the stream back, and could help pinpoint the main issue.

About command line parameters, I suggest you check https://wiki.videolan.org/Documentation ... _Examples/ https://wiki.videolan.org/Transcode/ https://wiki.videolan.org/Documentation ... mand_Line/ which should have all the information you need.

Theoretically libvlc is thread safe, so you can call its method in any thread you want. VLC will create more threads as it needs them

alhano
New Cone
New Cone
Posts: 2
Joined: 29 Jan 2018 16:26

Re: Recording generating huge files

Postby alhano » 30 Jan 2018 16:37

Thanks for reply.

I first make a test by invoking from the command prompt vlc.exe for recording using the 3.0.0-rc8 version.

The commands looks like this.
vlc rtsp://192.168.10.4:88/videoMain :sout=#standard{access=file,mux=ts,dst="test-cam-4.mp4"}

The camera I use is a Foscam FI9831P.

It does generate the test-cam-4.mp4 file, and the size shown remains equal to 0 until I close the VLC player window (refreshing the explorer has no effect).
After the player window is closed, I can see that a vlc.exe process remains and the file continues to grow. I finally end up killing the process.

The file which has been generated is huge : 2.5 GB for a few minutes. But It contains virtually nothing. It's full of 0xFF characters.
Compressing it with 7zip will result in a file of 383 KB.

Here is a sequence.

47 40 00 30 a6 00 ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff 00 00 b0 0d 9b
3d c5 00 00 00 01 e0 20 91 d2 f7 e4 47 40 20 30
9b 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff 00 02 b0 18
00 01 e5 00 00 e0 64 f0 00 1b e0 64 f0 06 0a 04
00 00 00 00 80 bf 7f 34 47 40 11 30 9d 00 ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

I have the same issue with VLC version 2.2.6.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 19 guests