| The Following User Says Thank You to int_ua For This Useful Post: | ||
|
|
02-24-2012
, 01:34 PM
|
|
|
Posts: 1,066 |
Thanked: 321 times |
Joined on Oct 2010
@ india, indore
|
#15
|
Thanks! Here's a python script which should handle it by itself. To run:record.py:Code:chmod 755 record.py; ./record.py
Code:import gst import time import os bin = gst.element_factory_make("camerabin") bin.set_property("videoenc", gst.element_factory_make("dspmp4venc")) bin.set_property("videomux", gst.element_factory_make("hantromp4mux")) bin.set_property("audioenc", gst.element_factory_make("nokiaaacenc")) while True: bin.set_state(gst.STATE_PLAYING) bin.set_property("filename", "current.mp4") bin.set_property("mode",1) #starts recording bin.emit("user-start") time.sleep(60) # stops recording bin.emit("user-stop") bin.set_state(gst.STATE_PAUSED) bin.set_state(gst.STATE_NULL) try: os.remove("twominutesold.mp4") except OSError: print "No two-minutes-old file exists yet." try: os.rename("oneminuteold.mp4", "twominutesold.mp4") except OSError: print "No one-minute-old file exists yet." os.rename("current.mp4", "oneminuteold.mp4")
import gst
import time
import os
bin = gst.element_factory_make("camerabin")
bin.set_property("videoenc", gst.element_factory_make("dspmp4venc"))
bin.set_property("videomux", gst.element_factory_make("hantromp4mux"))
bin.set_property("audioenc", gst.element_factory_make("nokiaaacenc"))
while True:
bin.set_state(gst.STATE_PLAYING)
bin.set_property("filename", "current.mp4")
bin.set_property("mode",1)
#starts recording
bin.emit("user-start")
time.sleep(60)
# stops recording
bin.emit("user-stop")
bin.set_state(gst.STATE_PAUSED)
bin.set_state(gst.STATE_NULL)
try:
os.remove("twominutesold.mp4")
except OSError:
print "No two-minutes-old file exists yet."
try:
os.rename("oneminuteold.mp4", "twominutesold.mp4")
except OSError:
print "No one-minute-old file exists yet."
os.rename("current.mp4", "oneminuteold.mp4")
chmod 755 record.py; ./record.py
|
|
02-24-2012
, 01:48 PM
|
|
Posts: 464 |
Thanked: 511 times |
Joined on Oct 2010
|
#16
|
is there anything which a noob can understand? i dont know what to do i just start xterminal and type
python
(after pressing enter)
should i paste your code (whole code) at once
or i should paste this only.....
and then this.........Code:import gst import time import os bin = gst.element_factory_make("camerabin") bin.set_property("videoenc", gst.element_factory_make("dspmp4venc")) bin.set_property("videomux", gst.element_factory_make("hantromp4mux")) bin.set_property("audioenc", gst.element_factory_make("nokiaaacenc")) while True: bin.set_state(gst.STATE_PLAYING) bin.set_property("filename", "current.mp4") bin.set_property("mode",1) #starts recording bin.emit("user-start") time.sleep(60)
and what do you mean by saying this...Code:# stops recording bin.emit("user-stop") bin.set_state(gst.STATE_PAUSED) bin.set_state(gst.STATE_NULL) try: os.remove("twominutesold.mp4") except OSError: print "No two-minutes-old file exists yet." try: os.rename("oneminuteold.mp4", "twominutesold.mp4") except OSError: print "No one-minute-old file exists yet." os.rename("current.mp4", "oneminuteold.mp4")
it says no such file or directoryCode:chmod 755 record.py; ./record.py
chmod 755 record.py; ./record.py
| The Following User Says Thank You to skykooler For This Useful Post: | ||
|
|
02-24-2012
, 02:07 PM
|
|
|
Posts: 1,066 |
Thanked: 321 times |
Joined on Oct 2010
@ india, indore
|
#17
|
Copy the code I posted into a file called record.py. Then run:
Code:chmod 755 record.py; ./record.py
|
|
02-24-2012
, 02:29 PM
|
|
|
Posts: 1,066 |
Thanked: 321 times |
Joined on Oct 2010
@ india, indore
|
#19
|
|
|
02-24-2012
, 04:13 PM
|
|
|
Posts: 572 |
Thanked: 842 times |
Joined on Jul 2010
@ Kyiv, Ukraine
|
#20
|
gst-launch v4l2src device=/dev/video0 ! queue leaky=upstream min-threshold-time=10000000000 ! autovideosink
That's all for today, I hope we will finish it tomorrow
![]() |
| Thread Tools | Search this Thread |
|
Or some git*
Always look at the post date. The information may be outdated.