Results 1 to 6 of 6

Thread: Performance: Displaying video in GUI without Phonon

  1. #1
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Performance: Displaying video in GUI without Phonon

    First time at QtCentre forum.. so I hope that you guys can help me!

    I currently developing an application, where I shall stream (or read) a video on a local hard-drive with a special format. This format has a special header and afterwards it has raw bytes of images with additional timestamps. These videos are normally >100 GB (not joking), so I want a efficient way of reading every frame in these files. At the moment I'm reading these by using QDatastream, but I have been suggested to use Memory Mapping instead. Is this the way to go?

    To make this more challenging, my application consist of a video player (where the functionality should be: show the current video, step between frames), where meanwhile an activated background thread should could process the video, frame by frame. I have to decide:
    • What kind of canvas should I display the video on?
    • How do I ensure, that I can see the video, while processing it in the background?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Performance: Displaying video in GUI without Phonon

    I have been suggested to use Memory Mapping instead
    Unless you have 100 GB of RAM, memory mapping probably is a waste of time if you are streaming through the video. The underlying operating system and disk controller will take care of buffering incoming data. Memory mapping is only useful when you have a very large chunk of RAM available and you can put a significant part of the file into it. With streaming, you'd be swapping out of the memory map as fast as you loaded into it.

    What kind of canvas should I display the video on?
    QLabel is typically used to display images.

    How do I ensure, that I can see the video, while processing it in the background?
    To ensure your GUI stays responsive, you could set the priority of the background thread lower than normal, unless you mean that the background thread is responsible for reading the data from disk and converting it to images to be displayed. If you mean that the processing has to keep up with normal video display rates, I'm not sure what you can do here.

    Why can't you use Phonon? It seems that nearly all the functionality needed is in there; you will need to roll your own back end for serving video frames, but you'll be doing that anyway in your own implementation.

  3. #3
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Performance: Displaying video in GUI without Phonon

    Quote Originally Posted by d_stranz View Post
    Why can't you use Phonon? It seems that nearly all the functionality needed is in there; you will need to roll your own back end for serving video frames, but you'll be doing that anyway in your own implementation.
    Is that possible? Do you have an example on how do this? I think this can be preliminary solution. But with time, it should be possible to modify each frame with some signal processing, and even mark objects in the movie with a dot.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Performance: Displaying video in GUI without Phonon

    I don't know a lot about Phonon, but I think if you create a MediaObject type to serve your frames off the disk, then you will be able to use the framework. It looks like the Effect type is what you would use to implement frame-by-frame processing. My understanding from reading the documentation is that Phonon uses what they call a "graph" (actually a processing pipeline) to move frames from a media source (like a file) to a media sink (like a video widget). You can insert nodes into this pipeline, branch it, connect multiple inputs together, etc. Looks pretty powerful.

    If you don't have audio associated with your images, you might be able to get by using QMovie with a custom QImageReader class. If you designed the QImageReader class correctly, you might be able to chain them together to implement your on-the-fly processing.

    Marking things on screen means that you will want to save that information somewhere, right? That means that you might have time-stamped metadata associated with your images, so that when you play it back the second time, the metadata marks appear along with the video. I think in that case you would have to use something like Phonon, and use an Effect to merge the metadata with the image frames.

    Sounds like a hard project, but interesting. The book "Advanced Qt Programming" by Mark Summerfield has a chapter on QMovie and Phonon with example code.

  5. The following user says thank you to d_stranz for this useful post:

    aamikkelsen (18th November 2011)

  6. #5
    Join Date
    Jan 2012
    Posts
    1

    Default Re: Performance: Displaying video in GUI without Phonon

    Hello Guy,A need a help please!!!!!!!!!! i'm new in Qt and OpenCv programming and I need for my application a GUI that's help me to play video and after processing an other window show me the vidéo after processing. someone can help me pleaseeee!!!!!!!!!!
    My contact :skyp:sossos1926

  7. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Performance: Displaying video in GUI without Phonon

    @up: on this forum you can get help with specific problem with your code, if you think you are gonna get whole working application for free, then you are wrong.
    There are many threads about Opencv + Qt on this forum, just use the "search" option. Try to write the code, and ask specific questions if you don't know how to proceed.

Similar Threads

  1. video fade in/out in phonon
    By panpanpandas in forum Qt Programming
    Replies: 2
    Last Post: 31st July 2011, 08:40
  2. Playing video using Phonon video widget
    By Leolander in forum Newbie
    Replies: 0
    Last Post: 26th February 2010, 06:15
  3. Performance problems playing video with Phonon and GStreamer on QT Embedded.
    By MarcosRodriguez in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd December 2009, 13:57
  4. Replies: 3
    Last Post: 5th July 2009, 17:22
  5. Video freezes during mpeg video playback using Phonon
    By davejames in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2009, 08:45

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.