473,397 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

AudioVideoPlayback: swapping videos = black interval

I'm using the (managed) Microsoft.DirectX.AudioVideoPlayback namespace
to program an app where I want to quickly swap the video that is being
displayed, playing the new video from the position where the old one
left off. Here's a sample of the relevant code:

// when this code is executed the current video
// is happily playing
current.Pause();
double pos = current.CurrentPosition;
current.Ending -= endHandler;

current = nextVideo; // next video has already been loaded
current.Ending += endHandler;
current.CurrentPosition = pos;
current.Owner = this.DisplayBox;
current.Play();

The problem is there is a brief black interval before the next video
starts playing. Because the interval is longer the further into the
video that the swap happens, I'm assuming that this has to do with the
codec getting the information ready. Problem is, I can't figure out any
way to force the codec to do this before I start playing, thereby
avoiding the black screen.

I've tried:
1- using Pause() or Play() before setting the Owner. Unfortunately this
opens a second display window.
2- Creating a second invisible PictureBox and assigning this as the
Owner. Then setting CurrentPosition and Pauseing. Then making it Visible
and Playing. The black interval still happens. Seems the Codec won't do
any decoding until it's actual got a surface to render to? (The video is
in DivX, processed with VirtualDub)
3 - Using SeekCurrentPosition(pos, IncrementalPositioning) instead of an
assignment to CurrentPosition. This didn't work at all, the video did
not play from the correct point.

Does anyone have any suggestions to try? Has anyone else solved this
problem?

Dave
Nov 16 '05 #1
2 1470
On Tue, 13 Apr 2004 23:04:18 -0700, D Cameron <da******@hotmail.com>
wrote:
I'm using the (managed) Microsoft.DirectX.AudioVideoPlayback namespace
to program an app where I want to quickly swap the video that is being
displayed, playing the new video from the position where the old one
left off. Here's a sample of the relevant code:

// when this code is executed the current video
// is happily playing
current.Pause();
double pos = current.CurrentPosition;
current.Ending -= endHandler;

current = nextVideo; // next video has already been loaded
current.Ending += endHandler;
current.CurrentPosition = pos;
current.Owner = this.DisplayBox;
current.Play();

The problem is there is a brief black interval before the next video
starts playing. Because the interval is longer the further into the
video that the swap happens, I'm assuming that this has to do with the
codec getting the information ready. Problem is, I can't figure out any
way to force the codec to do this before I start playing, thereby
avoiding the black screen.


The problem is the video renderer displaying a black frame before it has
any real video to show. I'm not aware of any good way around this, short
of writing your own video renderer in C++. (Which I did, partly to
overcome this problem.)

--
Be seeing you.
Nov 16 '05 #2
Thore Karlsen [MVP DX] wrote:
On Tue, 13 Apr 2004 23:04:18 -0700, D Cameron <da******@hotmail.com>
wrote:

I'm using the (managed) Microsoft.DirectX.AudioVideoPlayback namespace
to program an app where I want to quickly swap the video that is being
displayed, playing the new video from the position where the old one
left off. Here's a sample of the relevant code:

// when this code is executed the current video
// is happily playing
current.Pause();
double pos = current.CurrentPosition;
current.Ending -= endHandler;

current = nextVideo; // next video has already been loaded
current.Ending += endHandler;
current.CurrentPosition = pos;
current.Owner = this.DisplayBox;
current.Play();

The problem is there is a brief black interval before the next video
starts playing. Because the interval is longer the further into the
video that the swap happens, I'm assuming that this has to do with the
codec getting the information ready. Problem is, I can't figure out any
way to force the codec to do this before I start playing, thereby
avoiding the black screen.

The problem is the video renderer displaying a black frame before it has
any real video to show. I'm not aware of any good way around this, short
of writing your own video renderer in C++. (Which I did, partly to
overcome this problem.)


I figured out a partial solution last night: reencoding the video with
many many keyframes (every 20 frames). Somehow, this actually made my
video files slightly smaller, and the black frame is almost completely
gone. There is some odd "stuttter" now during seeking, but overall it's
better.

Dave
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DavidM | last post by:
Hello - I recently purchased Camtasia for our training folks to begin recording videos on how to use various inhouse applications both for our customers and internal users that access our Extranet...
271
by: Jatinder | last post by:
I found these questions on a web site and wish to share with all of u out there,Can SomeOne Solve these Porgramming puzzles. Programming Puzzles Some companies certainly ask for these...
1
by: Kieran Benton | last post by:
Hi everyone, Sorry this is more than a little off topic but Im having a terrible time trying to get anyone at the managed directX groups to reply so I'm going to try with everyone here as they are...
2
by: D Cameron | last post by:
I'm using the (managed) Microsoft.DirectX.AudioVideoPlayback namespace to program an app where I want to quickly swap the video that is being displayed, playing the new video from the position...
0
by: Tim Bücker | last post by:
Hello. I have a problem using Microsoft.DirectX.AudioVideoPlayback; Video. The property CurrentPosition gets the current position in the buffer but not the current position of the frame that is...
1
by: Charles Herring | last post by:
In my asp.net application I upload a video file and then need to get the duration and other properties. I get "Attempted to access an unloaded AppDomain" when I instanciate the Video object. I am...
2
by: Ian | last post by:
Does anyone know of a way where you can bind one of the Audio objects from DirectX.AudioVidoPlayback to a DirectX.DirectSound object? I need to do this because I need to be able to play several video...
2
by: Bernhard Bauernhofer | last post by:
how can i adjust the volume of a video? that doesn't work: ourVideo = New Video(vid1) ourVideo.Owner = Me ourVideo.Audio.Volume = 0 'Start playing now ourVideo.Play()
0
by: Terry Olsen | last post by:
If I have an audio file playing using DirectX.AudioVideoPlayback.Audio and I click the stop button, using the following code: Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As...
4
by: mariusz | last post by:
Hi All, I have a problem with component DirectX.AudioVideoPlayback.Video. Following part of code works good but I have one problem. The movie is allways on the top left corner of the display....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.