Linux: cat /dev/video0 TS into some kind of ring puffer

2

I want to cat a /dev/video0 device output (Transport Stream) into a temporary ring buffer. In fact i do not want that the file is growing over the time. Simultaneously access is not possible.

So the purpose is to have a file (buffer, Fifo, whatever) to be accessed by more than one consumer (example: tail -f, mencoder, VLC, ....).

Some kind of scenario: 
1# cat /dev/video0 > mybuffer.ts
And then multiple access
2# tail -f mybuffer.ts > extract1.ts
2# tail -f mybuffer.ts > extract2.ts
3# ffmpeg ... 

Does someone have an idea how to do something like this?

user155384

Posted 2012-08-30T09:14:32.143

Reputation: 21

How would the ring buffer know when all of the clients have connected to it? – Ignacio Vazquez-Abrams – 2012-08-30T09:18:28.227

Does the ring buffer has to know? I start the "producer" and the /dev/video0 output will be continuously written into the buffer. The consumers grabs the data from the buffer. – user155384 – 2012-08-30T09:25:41.067

How will the buffer know that it can release old data? – Ignacio Vazquez-Abrams – 2012-08-30T09:26:08.463

The buffer can release older data after a certain file size is reached (for example). 1MB, 10MB ... in fact i just need the kind of "buffer" to create a point/file/source to grab data from multiple consumers because /dev/video0 does allow only 1 consumer. – user155384 – 2012-08-30T09:33:08.657

But what if another consumer wants its contents after the certain size is reached? – Ignacio Vazquez-Abrams – 2012-08-30T09:40:30.873

Consumers are grabbing just the newest data/last inserted stream images (tail -f). If file size is reached, the oldest data in the buffer will be thrashed. A consumer never grabs images older than "now" or seeks inside the buffer. – user155384 – 2012-08-30T10:05:07.617

No answers