Skip to main content
GameDev.net gamedev.net
🔒 Locked

Video play in backward

Started by tiramisung Jun 18, 2010 at 4:11 AM 7 replies 2.4k views
Original Post
tiramisung
tiramisung
Hi, Currently i try to do video playback. So far, there have function of play forward,pause and stop. May i know how about video play in reverse or backward?

Thanks for your help :p
Burnhard
Burnhard
You will need to give more information as to how you're playing the video in the forward direction in the first place, before this question can be answered.
tiramisung
tiramisung
Actually , i just play forward video like below :

Video video = Video.FromFile("video.avi");
video.Play();

Here, i would like to know how about a video play backward?
Got any idea to do it?
nobodynews
nobodynews
Quote:
Original post by tiramisung
Actually , i just play forward video like below :

Video video = Video.FromFile("video.avi");
video.Play();

Here, i would like to know how about a video play backward?
Got any idea to do it?


So what language is that written in? Did you write the code for Video? If not, where did you get get from?
C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) ,
tiramisung
tiramisung
Video is come from directX which is using Microsoft.DirectX.AudioVideoPlayback.
Language is c#.

Any idea?
Adam_42
Adam_42
The easiest option is to use a video editing program to create a second copy of the video that has the frames in reverse order.

The reason being that video compression is usually only designed to be able to play it back smoothly going forwards. You could try leaving it paused and using SeekCurrentPosition, but it probably won't work very well.
tiramisung
tiramisung
Thanks for reply.
I had try to using SeekCurrentPosition but sure play not well.
Any other idea?
Thanks...
__ODIN__
__ODIN__
Video streams consists of I frames and P Frames; each I frame is a standalone frame, but each P frame is relative to the frames before it (usually the last P/I frame before it). Since the data's not available, you can't really step backwards; it just doesn't have a P frame for "this frame -1"; you'd need to find the last I frame before it, then reconstruct all the P frames up to the frame you're looking for. That could get.. expensive.


Allan
Evil Steve
Evil Steve
What exactly are you trying to do? If you're writing some sort of video editing software, you should be storing the video uncompressed, so each frame is it's own uncompressed image.
If you have a specific video you want to play backwards, just re-encode a reverse version of the video.
If you want to reverse an arbitrary video, you'll probably find that you'll need to play the video forwards, capture each frame, and write it out in reverse (I.e. re-create the video file). As others have said, normal video codecs don't support playing the video backwards.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.