[vlc-devel] (no subject)

Jeremy Vignelles jeremy.vignelles at dev3i.fr
Thu Oct 12 12:04:23 CEST 2017


> Le 12 octobre 2017 à 11:35, Rémi Denis-Courmont <remi at remlab.net> a écrit :
> 
> Le 12 octobre 2017 12:17:00 GMT+03:00, "Jérémy VIGNELLES" <jeremy.vignelles at dev3i.fr> a écrit :
> 
> > Use case
> > 
> > ---
> > 
> > I need a way to record permanently a CCTV camera in a rolling buffer
> > of,
> > say, 1 day. As far as I know, this is not possible currently with VLC.
> > 
> > I have seen the ticket #561, opened 12 years ago, which asks
> > for a similar feature.
> > 
> > A "cycle" stream output plugin has been implemented, but it works in a
> > different way : predefine a loop of files and write in them
> > alternatively.
> > 
> > My implementation differs from the "cycle" module in the way that
> > nothing
> > is overwritten, and it's up to an external hypervisor to retain or
> > remove
> > files as needed.
> > 
> > How does it work
> > 
> > ---
> > MPEG-TS is a muxing format in which blocks are normally 188 bytes long
> > (VLC can do "unaligned" blocks). Starting a file from any of the blocks
> > gives a valid MPEG-TS stream.
> > 
> > Based on that statement, the idea is to fill a file with blocks, until
> > a
> > limit is reached, and then switch between files between two blocks.
> > 
> > MPEG-TS also has an option to specify a key, so that the stream can be
> > encrypted, which is useful when working on sensitive stream, like in
> > CCTV
> > scenarios.
> > 
> > Configuration parameters
> > 
> > ---
> > dst= in the sout chain specifies the directory to which files are
> > written.
> > 
> > The file name can be formatted using the
> > --sout-segments-format specifier, which takes strftime format as
> > argument
> > 
> > --sout-segments-max-filesize limits the file size before
> > which we need to switch files. Defaults to 94MB, which is a round
> > number
> > of 188-bytes blocks.
> > 
> > Example usage
> > 
> > ---
> > vlc -vv
> > --sout="#std{access=segments,mux=ts,dst=/path/to/recording/folder}" \
> > --sout-segments-format "%Y%m%d%H%M%S.ts" --sout-max-filesize 1880000 \
> > --sout-ts-crypt-audio --sout-ts-crypt-video --sout-ts-csa-ck
> > 0123456789ABCDEF \
> > rtsp://192.168.0.3/axis-media/media.amp
> > 
> > Example replaying
> > cat /path/to/recording/folder/*.ts | vlc --ts-csa-ck 0123456789ABCDEF -
> > 
> > Or you can just play one by one.
> > 
> > Caveats
> > 
> > ---
> > 
> > *   The file format can only be precise in seconds, due to the way
> > strftime
> > works. If the max-filesize represents less than 1 second of video,
> > there
> > is a risk that two files have the same name, and thus, the second
> > will be overwriting the first one
> > *   Obviously, it does only work with MPEG-TS stream and was optimized
> > for that
> > muxer. There is no check that the stream is actually muxed with
> > MPEG-TS.
> > *   There is no guarantee that the first block in a file contains a
> > I-frame.
> > When replaying, there can be a latency before anything is shown on the
> > screen.
> > 
> > Closing
> > 
> > ---
> > Please send me your (kind) remarks about this code, about my usage
> > example
> > ("You could have done this that way!")...
> > 
> > Regards,
> > Jérémy VIGNELLES
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> 
> I don't see how the described functionality is any different from cycling with a single entry per cycle. The existing cycle module is perfectly able to output a different file at every iteration when combined with the file output module time format function.
> --
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

Hi,
I didn't know you could do that. What is the syntax to do that?

./vlc -vv --sout="#cycle{dst=std{mux=ts,access=file,dst=/c/Users/JeremyVignelles/Desktop/rec/%Y%m%d%H%M%S.ts},duration=30s}" --sout-file-format --sout-ts-crypt-audio --sout-ts-crypt-video --sout-ts-csa-ck 0123456789ABCDEF rtsp://root:pass@10.10.210.101/mpeg4/media.amp

This line falls in an infinite loop...

The only difference I see between my code and the cycle is the unit of the limit, and in my case I can use both, so I give up the idea of merging this plugin.


More information about the vlc-devel mailing list