473,503 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2163
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

271
19888
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
12989
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
1433
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
1852
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
2319
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
2499
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
2126
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
2010
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
3302
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
7204
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
7091
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
7342
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
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5586
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,...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.