raspberrypi / userland

Source code for ARM side libraries for interfacing to Raspberry Pi GPU.
BSD 3-Clause "New" or "Revised" License
2.05k stars 1.09k forks source link

Add support for circular buffer in raspivid witout closing when trigering USR1 #404

Open MeAntonio opened 7 years ago

MeAntonio commented 7 years ago

Would be great to make that raspivid doesn't stop when triggering -USR1 signal in circular buffer mode, only taking t seconds of video and write it into file video%04d.h264 or directly to stdout. It would be great to trigger it more than once without spending time on initializing camera every time.

I'm looking into solution.

purppleshroom commented 7 years ago

Here is my solution: (I'm also meAntonio)

Added 1 more option -cm that activates saving circular buffer into file like this_%03d.h264 which for every -USR1 signal saves circular buffer into file and then opens new file. Property -cm should be used with -c. Also when setting -t under 2 sec You should set -g to 2-5 to work properly.

Here is the example of usage: raspivid -c -cm -n -o name_ofvideo%05d.h264 -t 1000 -s -g 3 -b 3000000

c - activates circular buffer cm - disables exiting when sending a signal n - no preview o - output name_ofvideo%05d.h264 - name of saving files (name_of_video_00000.h264, name_of_video_00001...)

You send a signal with: kill -USR1 pid //you can get the pid with "pidof raspivid" command.

Still not working 100% percent, after some time ON it starts throwing mmal error Error in frame list which I haven't fully understood yet.

https://github.com/Tonchyk/raspivid-multitriger-circular-buffer

Would like other people look at it.

JamesH65 commented 6 years ago

It's much easier for us to see what you have done if you submit a pull request (we get all of githubs code comparisons to play with). So if you are still working on this, that might be a good approach. If you are not working on it, can you close the issue?

purppleshroom commented 6 years ago

Will submit soon, got it working.

Dana 5. pro 2017. 15:45 osoba "James Hughes" notifications@github.com napisala je:

It's much easier for us to see what you have done if you submit a pull request (we get all of githubs code comparisons to play with). So if you are still working on this, that might be a good approach. If you are not working on it, can you close the issue?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/raspberrypi/userland/issues/404#issuecomment-349324903, or mute the thread https://github.com/notifications/unsubscribe-auth/AXqIurFl91WnYagpgHnEN2Jy3dB9MZRnks5s9VcGgaJpZM4OA_Zc .

JamesH65 commented 6 years ago

@Tonchyk Was this PR ever submitted?

syadnom commented 6 years ago

yeah, would really like to use this...

JamesH65 commented 6 years ago

Happy to assess any PR's that turn up.

jimbo1969 commented 6 years ago

This is exactly what I'm looking for as well. I'm wondering if it is already implemented somehow/somewhere. My apologies if it is obvious. Is any other follower of this thread aware of any publicly-available implementation of this functionality? I don't know how to tell which GitHub branches are really making their way back into the "official" raspivid/picamera code, so I feel like I'm barking up a bunch of random wrong trees.

I'm looking to repeatedly trigger the storing of ~5 sec video clips to a large storage device for postprocessing. My trigger will not occur until halfway-through the clip, and I might occasionally have one immediately (~1 sec) following another.

Thanks!