Active Topics

 



Notices


Reply
Thread Tools
int_ua's Avatar
Posts: 676 | Thanked: 1,067 times | Joined on Jul 2010 @ Kyiv, Ukraine
#11
let's start garage project for this, I can't wait to post commits
Or some git*
 

The Following User Says Thank You to int_ua For This Useful Post:
int_ua's Avatar
Posts: 676 | Thanked: 1,067 times | Joined on Jul 2010 @ Kyiv, Ukraine
#12
But 3 seconds are lost on each video.
 

The Following User Says Thank You to int_ua For This Useful Post:
int_ua's Avatar
Posts: 676 | Thanked: 1,067 times | Joined on Jul 2010 @ Kyiv, Ukraine
#13
Maybe let's talk on #maemo@freenode?
 

The Following User Says Thank You to int_ua For This Useful Post:
Posts: 482 | Thanked: 550 times | Joined on Oct 2010
#14
Originally Posted by int_ua View Post
Great start
Just move STATE_PLAYING into while loop and fix prints, please
I fixed that.
 

The Following 2 Users Say Thank You to skykooler For This Useful Post:
nicholes's Avatar
Posts: 1,103 | Thanked: 368 times | Joined on Oct 2010 @ india, indore
#15
Originally Posted by skykooler View Post
Thanks! Here's a python script which should handle it by itself. To run:
Code:
chmod 755 record.py; ./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")
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.....

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 then 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")
and what do you mean by saying this...


Code:
chmod 755 record.py; ./record.py
it says no such file or directory
__________________
N900 gave me a reason to live in this cruel world

get your smooth live wallpaper today
My YouTube videos
 
Posts: 482 | Thanked: 550 times | Joined on Oct 2010
#16
Originally Posted by nicholes View Post
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.....

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 then 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")
and what do you mean by saying this...


Code:
chmod 755 record.py; ./record.py
it says no such file or directory
Copy the code I posted into a file called record.py. Then run:
Code:
chmod 755 record.py; ./record.py
 

The Following User Says Thank You to skykooler For This Useful Post:
nicholes's Avatar
Posts: 1,103 | Thanked: 368 times | Joined on Oct 2010 @ india, indore
#17
Originally Posted by skykooler View Post
Copy the code I posted into a file called record.py. Then run:
Code:
chmod 755 record.py; ./record.py
i opened leafpad and paste your code and save it as record.py(in /home/user)

than i try to run it but first permission denied and import not found

so i sudo gainroot and than run it but still import not found

there are screen shot for you thanks in advance!
Attached Images
  
__________________
N900 gave me a reason to live in this cruel world

get your smooth live wallpaper today
My YouTube videos
 
Posts: 482 | Thanked: 550 times | Joined on Oct 2010
#18
Oops, add
Code:
#!/usr/bin/env python
to the beginning of that file.
 

The Following User Says Thank You to skykooler For This Useful Post:
nicholes's Avatar
Posts: 1,103 | Thanked: 368 times | Joined on Oct 2010 @ india, indore
#19
Originally Posted by skykooler View Post
Oops, add
Code:
#!/usr/bin/env python
to the beginning of that file.
Finally it works!

Thanks to all of you guys and devlopers.

speacial Thanks to skykooler and int_ua
__________________
N900 gave me a reason to live in this cruel world

get your smooth live wallpaper today
My YouTube videos
 

The Following 2 Users Say Thank You to nicholes For This Useful Post:
int_ua's Avatar
Posts: 676 | Thanked: 1,067 times | Joined on Jul 2010 @ Kyiv, Ukraine
#20
I just finished first attempt to get gst-launch working and queue works as expected with this code:
Code:
gst-launch v4l2src device=/dev/video0 ! queue leaky=upstream min-threshold-time=10000000000 ! autovideosink
(time in nanoseconds)
Now it would be great to try to use queue sink in the above python code instead of moving files That's all for today, I hope we will finish it tomorrow
 

The Following 3 Users Say Thank You to int_ua For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 11:52.