Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi People,

I have been developing a wxPerl application for about a year now, one of my outstanding issues is how to get a live video feed to display. So far I have been using Wx::MediaCtrl and all my testing has been done on stored videos. However, I feel the time has come to bite the bullet and get the live feed to work. I am developing on Linux (Kubuntu) and Wx::MediaCtrl uses GStreamer as the back end. I had hoped that I could simply use:

$success_status = $i_frame->{Ctl_Videos_Media}->LoadURI ('/dev/video0');

but it doesn't work, it doesn't give me an error message, and it doen't even return a success status (but if I do a GetStatus on it I get '0').

My second thought was:

  • run ffmpeg from the command line: ffmpeg -f oss -ac 2 -ar 48000 -i /dev/dsp -acodec pcm_s16le -f video4linux2 -s 720x480 -r 30000/1001 -i /dev/video0 -sameq -aspect 4:3 -f avi -vcodec mjpeg -r 30000/1001 -y test.avi, which works fine.
  • Then use $i_frame->{Ctl_Videos_Media}->Load ('test.avi');, which also works but only for the video recorded *before* MediaCtrl started. When it gets to the point in time where the webcam was when the program started it crashes. That is to say, you can't Seek to the end of the .avi file and play what is currently being added to it.

*However*, there is hope, if I run the following command at a command prompt: gst-launch-0.10 v4l2src ! tee name=videoout ! queue ! videorate ! video/x-raw-yuv,fps=15 ! queue ! theoraenc quality=60 ! queue ! muxout. oggmux name=muxout ! filesink location=lulz.ogg videoout. ! queue ! ffmpegcolorspace ! ximagesink, I get a stored file which I can seek through and a live feed being displayed through a window with about a half-second latency. If only that window was a MediaCtrl window it would be perfect. As gst-launch is a GStreamer application and Wx::MediaCtrl uses Wx::GStreamerMediaBackend, I assume that I can somehow splice these programs together, but here I get lost.

As usual, your wisdom and thoughts would be very welcome.

Regards

Steve


In reply to Using Wx::MediaCtrl to display a live videofeed (eg a webcam) by Steve_BZ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-20 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found