Results 1 to 3 of 3

Thread: video fade in/out in phonon

  1. #1
    Join Date
    Jul 2009
    Posts
    3
    Qt products
    Qt4

    Default video fade in/out in phonon

    Hi all,

    Is video fade in/out supported in phonon? Or anything that works when playing several videos?

    Thanks!

  2. #2
    Join Date
    Jul 2011
    Posts
    2
    Qt products
    Qt3 Qt4

    Default Re: video fade in/out in phonon

    //Hi! , dont know if it helps or its too late for posting..... I dont know if theres an easier way or if its already has an implemented function but... I did fade in and fade out"EFFECT" using Phonon::MediaObject brightness and contrast properties....
    //SORRY FOR ENGLISH BUT I SPEAK SPANISH ...
    //for example:

    //CREATING THE VIDEOWIDGET
    Phonon:;VideoWidget *widget = new Phonon::VideoWidget(this);
    //"this" could be anything, thats just your parent so you choose...


    //CREATING MEDIASOURCE
    Phonon::MediaSource *media = new Phonon::MediaSource("your video path (you can actually use QFileDialog::getopenFileName to get a popup window to get the path of your file as it return a QString path if you ar using and QAPP)");

    //CREATING MEDIAOBJECT
    Phonon::MediaObject *mobj = new Phonon::MediaObject();
    mobj->setCurrentSource(media);

    //CREATING A PATH FOR THE VIDEO TO OUR WIDGET AND PLAYING IT

    Phonon::CreatePath(mobj,widget);
    mobj->play();

    //NO WE CAN PLAY AROUND WITH THE BRIGHTNESS AND CONTRASTS VALUES OF THE MEDIA OBJECT, if u got a slider on your app for that specific video u can use the signal onValueChanged() and connect it to a slot function that modifies your brightness and contrast values
    //SO YOU CHOOSE HOW TO MODIFY THE VALUES ,QTIMER,QPROPERTANIMATION.....
    //BUT WHEN MODIFYING VALUES FOF BRIGHTNESS AND CONTRAST OF THE MEDIAOBJECT YOU NEED TO USE NEGATIVE VALUES! IN ORDER TO CREATE THE "FADE EFFECT"

    //for example:
    int myvalue = 50;//you can modify this value with a function yourself

    mobj->setContrast(myvalue/100.0) //it needs a qreal level which is the same as a double value
    mobj->setBrightness(myvalue/100.0) //THIS BOTH ARE NOT GOING TO WORK FOR OUR PURPOSES

    /you must do it with negatives....
    mobj->setContrast((myvalue-100,0)/100.0) //it need a qreal level which is the same as a double value
    mobj->setBrightness((myvalue-100.0)/100.0) //OHH and im dividing by 100.0 cause the qreal level is from 0 to 1.0 not 0 to 100.0

    //OHH REMEMBER THIS WILL ONLY OUT VIDEO NOT AUDIO.... YOU MUST USE Phonon::AudiOutput in order to play audio since we are using VideoWidget not VideoPlayer...
    //THIS WAY YOU CAN GET A FADE EFFECT USING PHONON... HOPES IT HELPS IN SOMEWAY ...

  3. #3
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: video fade in/out in phonon

    A slightly more resource minded approach could be handled by overlaying a QLabel over the widget and fading that in/out between videos. I could be wrong, but it might be lighter on resources than playing a video with effects.

Similar Threads

  1. v4l2 video capture input in Phonon
    By abbot in forum Qt Programming
    Replies: 6
    Last Post: 16th February 2011, 10:31
  2. QT 4.4 / Phonon / Video / Rendering a single frame
    By rextr in forum Qt Programming
    Replies: 10
    Last Post: 5th January 2011, 13:47
  3. Replies: 3
    Last Post: 5th July 2009, 17:22
  4. grab images from Phonon video
    By Kraut~salat in forum Qt Programming
    Replies: 3
    Last Post: 19th January 2009, 09:53
  5. Video freezes during mpeg video playback using Phonon
    By davejames in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2009, 08:45

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.