locked
Seamless Video Playlists using Media Foundation/C++/Win32 RRS feed

  • Question

  • I am trying to achieve gapless video playback using the Media Foundation API's and C++. I have so far created a Playlist using the tutorials. I create the media sources, followed by the topologies which I then append to the Sequencer source.  The problem being there is always a black space or a white space between the videos. What is the easiest way to remove this gap if there is any. If there isn't I need to know so I can move on to another technology to achieve what I need.
    • Edited by Derek Cody Tuesday, April 22, 2014 7:48 PM
    Monday, April 21, 2014 9:11 PM

All replies

  • Is this really an unanswerable question? I am just looking for Gapless video looping...
    Tuesday, April 22, 2014 3:38 PM
  • Hello.

    Do you have a simple sample source code to provide that show the problem, so that we can check it, and find a solution if possible.

    Friday, April 25, 2014 7:45 PM
  • Hello.

    Out of curiosity, i looked into sequencer source.

    I use two mp4 video and there is no gap in the stream.

    I will update my project MFNode with source code i've tested.

    I just handle two video streams, not a playlist. Transition seems to be ok.

    PS: i realize that sequencer source doesn't fade in/out between transition. It would be a great feature.


    • Edited by Miaou77 Saturday, April 26, 2014 11:48 PM
    Saturday, April 26, 2014 11:43 PM
  • I use 2 MP4 videos and there is a gap between them for a little less then 1 second.

    Edit:

    As for the source code I am using the sample code provided here:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ee663621(v=vs.85).aspx


    • Edited by Derek Cody Monday, April 28, 2014 2:50 PM
    Monday, April 28, 2014 2:35 PM
  • Hello.

    Did you try my project ? Check MFNodePlayer and sequencer session.

    Wednesday, April 30, 2014 10:20 PM
  • Hi Miaou77

    I have finally got your code compiling in my environment and your sequencer works perfectly! Just the way I would expect it to. What exactly do you do differently then the example code provided in MSDN?

    Thanks,

    Derek

    Friday, May 2, 2014 2:54 PM
  • Hello.

    The lonely difference is that my sequencer just make one transition between two mp4 files. The sample from MSDN provides a way to handle playlist. i do this, just to check if transition would be good. Now, i could add playlist transition, because i know transition is good. Doing things gradually is a good way to make difficult software.

    I think that the problem can be the way you handle MediaSession and events. I think the difficulty is here. The sequencer source, in itself is simpe to use. The lonely difficulty i found, was how the MediaSession behaves, according to adding Topology inside. But reading the documentation about MediaSession was helpfull.

    Friday, May 2, 2014 11:01 PM
  • Hey,

    So I was exploring the differences in our projects and I saw yours only calls SetTopology a single time for your sequencer source example. Yours then plays smoothly through. Mine on the other hand receives an MENewPresentation after the first source is finished and calls set topology again. I think this set is what is causing the black spot between MP4's. Any advice you can give me on getting both my sources to play to with a single set topology?

    Thanks,

    Derek

    Tuesday, May 6, 2014 8:05 PM
  • Hello.

    Check my project i call SetTopology twice. But not in the same code.

    First, in OpenSequencer (MFNodePlayer.cpp), i create the two topologies and append them to the sequencer. Then i set the first topology to the MediaSession (first call to SetTopology). And finally play the session if all is ok.

    When the MediaSession start, i receive MENewPresentation, and then i set the second topology to the MediaSession. The second call to SetTopology.

    Because it is the last topology, i do not receive a second MENewPresentation.

    For a playlist, you need to append three topologies if you want to loop at each MENewPresentation.

    Now i think that Sequencer has bad design, because it should send MENewPresentation, even if it is the last topology. With this design, you must append three video before start playing.

    By the past, i've made such playlist with one file using DirectShow. When the file begins to play, you prepare the next, and so on.



    • Edited by Miaou77 Wednesday, May 7, 2014 9:16 PM
    Wednesday, May 7, 2014 9:09 PM