Displaying WebCam video with Qt - linux

I'm using Qt 4.5 (2009.03) on Linux Gnome (Ubuntu 9.04) and would like to display video captured by my webcam in a Phonon::VideoWidget of my Qt application.
I have a first implementation using the v4l2 API where I do the YUV2 to RGB conversion and fill a QImage my self. It works well but it is not very efficient. A collegue used gStreamer to do the same thing and it was much much faster.
Since then I found out about phonon and would like to use it. Everything is configured and set up except for the binding to the webcam device as source.
I should create a MediaSource object but I don't know how to configure it. Any help would be greatly valuable.
Edit: The Phonon overview explains that it is not supported yet. But I need a solution.

I know its little bit late for this question. but I was looking for the same thing and could not find pure qt solution. Here is my solution https://sourceforge.net/p/qtv4lcapture/code/HEAD/tree/

If your goal is to display the YUV image on the screen you can use the OpenGL module. Implement the conversion as a fragment shader. If you want to do something else like save the converted image to a file then it is not a good idea.
Some links:
http://doc.qt.digia.com/4.6/qglshaderprogram.html
http://doc.qt.digia.com/4.6/qglshader.html
http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c (the conversion is in the FProgram string)

Maybe you can take a look the way kapture was implemented.

Related

Screen video (screencast) recording on Linux

I was trying to record video of all the monitors or a selection, so was wondering what to use for Linux.
The thoughts that came to mind were screenshot the screen a bunch but this probably isnt the right way to go about it.
I looked at the Cairo docs but can't find anyhting. On Windows I found DirectShow and OSX I found AVFoundation.
edit:
i just came across something: XvGetVideo would this be an option?
You can check out ffscreencast with the --dry parameter which will show you the commands that would be issued. Looks nice for learning.
Did it under linux and it showed me it was using x11Grab

Cocos2d - SimpleAudioEngine - Sound is not playing on iPhone

Recently I have a problem with playing my soundeffects using CocosDenshion. The sound is playing on the iPhone Simulator, but not on my own device. I am not sure what I am doing wrong. Off course I checked if my speakers are still working, but they do while using other apps or the iPod Library.
I just use this simple code:
[[SimpleAudioEngine sharedEngine] playEffect:#"button.wav"];
I double checked the name of the file and it indeed is button.wav.
I hope someone can help me out.
I had the same problem recently and I've figured it out.
I' m using Xcode 4.3.2 and there seems to be a bug.
Not all resources you add (drag) to the project are by default added to the target.
When you add a resource, make sure that (apart from checking the copy items into destination checkbox) you also check the add to target checkbox.
You can check if the resources has been added to the bundle by clicking on the target icon. In the Build Phases tab, check if the sound files are included in the Copy Bundle Resources.
If not, add them manually (+add target)
You might try preloading the sound effects, at some earlier point in the program, as otherwise it has to load the sound effect before it can play it. You could create a splashScreen scene that is the first scene and loads all your assets and then transitions to the first "actual" scene.
SimpleAudioEngine *engine = [SimpleAudioEngine sharedEngine];
[engine preloadEffect:#"Example-Sound.caf"];
Not sure whether it is the case here, but you should keep in mind that if your file name is "Button.wav" and you are asking to playEffect:#"button.wav" it will play on simulator, but will not on the device. This effect takes place because filesystem on your desktop is case-insensative, and on iOS devices it is not.
I have the same problem and find here. But I fix it by myself.
If you reinstall ios for ipad. the default switch(upon the volume) is default as "mute volume" method. Maybe I change it to "rotation" method when it is mute. It lead to all cocos2d can't play sound any more. So I turn the method back and set mute off. And then SimpleAudioEngine works well. It is ios system's bug.
Make sure to check your audio file itself. A Mono 16 Bit, Uncompressed wave with a sample rate of 441000 should 'just work'. I recommend grabbing a sample .wav from an online Cocos2D example, like the Cowbell.wav and try to play that file.

More customizable flash mp3 player for website?

the only mp3 flash player I've see has been the Google Audio widget which is limited in its appearance.
http://www.widgetbox.com/widget/mp3
For my wordpress, I like the player I use 1 Pixel Out's, which is great:
http://www.1pixelout.net/code/audio-player-wordpress-plugin/
Anyway I could use this without much coding on a regular, non-wordpress, php page?
In a three step process you could add it to any webpage you like; in my book that is not too much coding at all. It's actually rather nice. The tutorial for how to do that can be found here: http://www.macloo.com/examples/audio_player/
I hope this helps.
I'd recommend A2 mp3 player - http://flashstall.com/7. It has a standalone version that can be used in general html/php pages and a wordpress plugin version that can be used in WP blogs.
I ended up using the standalone version of pixelone.

DirectDraw Overlays

Does anyone have a working example (code) of a DirectDraw overlay? Like something moving on the screen. I have been trying to find an example of DirectDraw overlaying usage and was unable to.
Thank you.
Try some of these:
from gamedev.net
from fourcc.org
[Edit] A bit more googling suggests you might want D3D Hooking? ..or have your tried the DirectDraw Overlay Library on CodePlex?
http://www.gamedev.net/community/forums/topic.asp?topic_id=359319
This code should work (I tried it when it comes out and it worked totally fine), its a little old and I don't know if it actually build with the actual SDK thought. (you maybe have to use an old SDK)

MP3 playback with dynamic tempo adjustment

I need to whip up a quickie app, something quick and dirty, on windows that lets a user control the tempo of a playing mp3 file with a slider.
Any recommendations on libraries/programming languages/controls that can make this easy?
I don't have control over the media choice (has to be mp3) or the platform (has to be windows)
Edit: Actually, I can convert the files to whatever format is necessary.
Windows Media Player v10+ has this built in. Take a look here. Isn't that what you need?
So far this is what I have found:
2xAV™ Plug-In For Windows Media Player®
Ideally, I would prefer something open source but if I can't find other options I'll give this a go.
You might take a look at this.
Edit: The WinMM.dll has a function called waveOutSetPlaybackRate (P/Invoke) which might be helpful as this DLL (which has been included with windows since Win 9x) can play MP3's. Here is some basic info on how to play the sounds using C#.

Resources