Need a big buffer to introduce delay in a pipe. (FIFO)
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Why not just use video file, I don't see the advantage of a "buffered pipe", especially if you want to fill the buffer completly (eg, it becomes a full video file)
I'm using dvgrab to catch live video from a camcorder and rawplay to show it on screen. Eventually what I want to achieve is a setup where I can press a button (or send a network signal or sth) so that the video instantly jumps back a fixed amount of seconds (45 sec in my case). Much like a replay of a goal in a sports match.
The main problem has been to figure out how to save those 45 seconds in a proper way. That's where I thought it made sense to store in a file in a FIFO kind of way..
A mock-up way of achieving what I want is to use two terminals.
In the first terminal, issue the following command:
Code:
dvgrab -|tee temp.dv|rawplay
And then in the second terminal 45sec later:
Code:
rawplay <temp.dv
By doing that there will be two videos running, one of which is 45 sec delayed and we can easily switch between them with alt-tab. But there are of course drawbacks:
Both windows play the sound at the same time
temp.dv is constantly growing
There are two cpu-heavy rawplay instances at the same time.
I don't know how to switch between the two windows over network or from a program
@keefaz: Do you mean why don't I just use a regular file instead of FIFO? If it's easier just using a regular file I don't mind that at all. I was just hoping to keep the buffer in RAM to keep diskload down and not having to worry about HD space. But not a big issue.
I would search on video player side, try to find one video player that could use a large buffer
(mplayer with -rawvideo would work for watching raw video but no buffer big enough to scroll back 45sec I am afraid)
It's not "resurrecting a thread" if you find an important new discovery. Threads from many years past are regularly searched-for by people who are encountering problems (again) now. Thanks.
If I understood this correctly, you simply need to wait 45 seconds before the output temp.dv to be written, before you can re-direct temp.dv back into rawplay for input?
The semicolon will allow the sleep command to run concurrently with the first. The && operator will succeed after 45s and then run the next command.
I am a little unsure if this is the way you want to proceed however. I've had bad experiences of using a input file that is currently being written too. Perhaps copy it and running the 2nd command off of the copy?
And thanks Sepero and BowCatShot, I learned both the PV and AT commands!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.