Results 1 to 10 of 10

Thread: Video in Qt designer 3

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2006
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Video in Qt designer 3

    Does anybody know how to display a video within a Qt generated dialog box? The video is being captured off a frame grabber card and uses gtk. Any help or suggestions would be greatly appreciated. I'm using Suse Linux 9.0 and Qt3. Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Platforms
    MacOS X Unix/X11
    Thanks
    1
    Thanked 52 Times in 52 Posts

    Default Re: Video in Qt designer 3

    You will have to use some media player backend: On Windows, DirectShow, on Mac Quicktime, on Linux either Mplayer or xine. There are may be others, but these are the most common I think.

    You would then get a window handle for a QWidget and pass it to these engines to play a video in that widget.

    Edit: What is your GTK-thing? Maybe you can embed that into Qt. But why do you want a QDialog when there is already a GTK solution?
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Aug 2006
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: Video in Qt designer 3

    I was wondering if you would know some plugin and associated API or classes for video codec allowing to play and extract video frame using Qt4 using QImageIOPlugin class.

    Quote Originally Posted by axeljaeger
    You will have to use some media player backend: On Windows, DirectShow, on Mac Quicktime, on Linux either Mplayer or xine. There are may be others, but these are the most common I think.

    You would then get a window handle for a QWidget and pass it to these engines to play a video in that widget.

    Edit: What is your GTK-thing? Maybe you can embed that into Qt. But why do you want a QDialog when there is already a GTK solution?

  4. #4
    Join Date
    Jun 2006
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Video in Qt designer 3

    Let me clarify my dilemma. I'm able to generate the video in a separate window from my Qt generated interface window using this line of code:

    char* arg1[3];
    arg1[0] = new char[128];
    arg1[1] = new char[128];
    arg1[2] = new char[128];
    strcpy(arg1[0],"vision");
    strcpy(arg1[1],"-d1");
    arg1[2]=NULL;
    int pid;
    pid = fork();
    if(pid ==0)
    {
    chdir("/home/dev/work/vision/0handvision/vision/");
    execvp( "./vision", arg1);
    }

    Its basically jumping to a different folder and running the video program from there but opens up in a separate window. My problem is....how do you display the video within my Qt generated interface window, so that there is only one window open? Much like how windows media player can be played within web browsers or quicktime within web browsers, etc.

    Any more help will be appreciated. Thank you.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Video in Qt designer 3

    Media player is used as an activeX control. If you want to embed a XServer application, it has to make embedding possible (like mplayer does).

  6. #6
    Join Date
    Aug 2006
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: Video in Qt designer 3

    I was wondering if you would know some plugin and associated API or classes for video codec allowing to play and extract video frame using Qt4 using QImageIOPlugin class.

    PS sorry for the quote I messed up - first time using the forum !

  7. #7
    Join Date
    Jan 2006
    Posts
    75
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 5 Times in 4 Posts

    Default Re: Video in Qt designer 3

    In order to achieve cross-platform purposes, maybe you can consider using MPlayer built-in feature that can be embedded in a window using the [-wid] option and QWidget's [winId()] method?

  8. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: Video in Qt designer 3

    during my early days with Qt3, I made a QVideo designer plugin.
    The plugin is cross platfrom, but it will axpect the image buffer as one of the following:
    unsigned char* - as gray scale
    unsigned int* - as RGB32
    unsigned short* - as RGB565
    unsigned char* - as RGB24
    or a QImage.

    If your frame grabber delivers one of these formats, I can post the plugin code for you here.
    QVideo has slots for the various buffers, so if you wrap your frame grabber in a Qt class, and send the frames via signals, the code is very elegant then. (thats the way I use it under linux)
    The plugin does no coding/decoding, just displays the given buffer, you will have to do that on your own (in your grabber class).
    It is for Qt3/Designer. (I hope to find some time to port it to Qt4... some day... )

    Let me know.

  9. #9
    Join Date
    Sep 2006
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Video in Qt designer 3

    high_flyer: I really would like to see QVideo code..and as the rest of my application uses QT4 I'd maybe have time to port it too.. (qt4 supports doublebuffering natively, that would be interesting)

    is your QVideo implementation suitable for real time applications (20-25fps)?

  10. #10
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: Video in Qt designer 3

    Ok, here it is.
    Remember, I made it a long time ago, so its not that nice to look at (code).
    But it works.
    Regarding realtime,yes, on a low end P4 with 500MB RAM, with low end graphic card, it has no problem doing a stereo ( two video streams) 640x480 at 30fps, under linux.
    I haven't tried it under windows.
    I'd be happy if you could post the Qt4 code if you'll port it.
    Regarding double buffering:
    I would tend to say that double buffering should be turned off when done in Qt4.
    I don't see how double buffering can help in such a widget as this one, where you want the full context of the widget repainted every time and as fast as possible, double buffering will only make it slower.
    Oh, and if you find time, it would be good to add a "repaint" after being partly or fully concealed by another widget.
    When the video is running, this is not needed ofcourse, but if currently the video is not running, the the current frame shown will not be refreshed.
    Hope this helps.
    Attached Files Attached Files

Similar Threads

  1. [SOLVED] DirectShow Video Player Inside Qt
    By ToddAtWSU in forum Qt Programming
    Replies: 16
    Last Post: 3rd November 2011, 07:47
  2. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28
  3. Video and QSlider
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 1st May 2006, 19:37
  4. Arthur Plugins demos and designer
    By antonio.r.tome in forum Installation and Deployment
    Replies: 4
    Last Post: 21st March 2006, 14:01
  5. Replies: 2
    Last Post: 14th February 2006, 15:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.