in reply to Perl wrapper for v4l2-ctl
I have a raspberry pi too, and I love it. If I were attempting it, I would use either mplayer or mencoder run by perl in slave mode, which you can see a sample of in ztk-v4l-video-bloger/recorder. That link shows the use of slave mode, but the v4l part is outdated. It may help you though. Basically you get a window id of the Tk container, the canvas is easiest, and pass that window id to mplayer in slave mode.
I have 2 working mplayer snippets which you may find useful. First is just display the camera in realtime.
The following nicely records video and audiomplayer -tv device=/dev/video0:fps=29.97 tv://
mencoder \ + tv:// \ + -tv driver=v4l2:device=/dev/video0:fps=30:width=640:height=480:for +ceaudio:alsa:adevice=hw.0,0 \ -ovc lavc \ + -oac lavc \ + -ffourcc divx \ + -noskip -mc 0 -ofps 30 \ + -o record-compressed-good-sync.avi
The problem is to get them to work simultaneously, so you can have a realtime Tk display and save to a file as you go. The mplayer and mencoder options show a -dumpstream and -dumpfile option, but I as yet have gotten them to work together. Some have suggested using a tee for output, but no luck there either. Maybe you will be the one to discover the coding trick needed.:-). So, I recommend using a c program to do the heavy video work, rather than Perl.
Here is an informative link describing the problem in full. play record same time.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl wrapper for v4l2-ctl
by stevieb (Canon) on May 15, 2017 at 19:53 UTC | |
by zentara (Cardinal) on May 15, 2017 at 20:47 UTC |