Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Mpeg-2 Video Seeking, frame accurate seeking in MPEG-2 video
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
videocrack
Posted: Feb 9 2013, 11:40 PM


Member


Group: Members
Posts: 27
Member No.: 26678
Joined: 27-December 09



Hello!

the last couple of days I've been trying to find out if it is possible to programatically (C++) seek MPEG-2 videos (recorded on Camcorder DVDs for example) with exact frame-accuracy. With directshow I only managed to seek to keyframes (implemented a seek bar with Display, using IMediaSeeking etc.). I've googled for program examples, asked questions on websites and checked MSDN for useful methods. Latter would always end at an dead-end: ''note [bla bla] does not support frame-accurate seeking.'', except for their newest development:

http://msdn.microsoft.com/en-us/library/wi...v=vs.85%29.aspx

where it says:

QUOTE
Seeking. For precise seeking, call the IMFTransform::SetOutputBounds method. When this method is called, the decoder outputs only frames that fall within the range of time stamps specified by the caller.

however, that only seems to work for the latest Windows platform, Windows 8.

So I'm lost wacko.gif

The reason why I ask this question here is because the MPEG-2 VirtualDub plugin by fccHandler does the job perfectly. So there obviously is a solution. But how much sense would it make to try and do the same. Is the source code publically available? Is there perhaps a ''simple'' solution that could be implemented with directshow?

Cheers
Stephan
 
     Top
dloneranger
Posted: Feb 10 2013, 12:15 PM


Moderator


Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07



fcchandlers mpeg2 sourcecode can be found at http://gral.y0.pl/~fcchandler/Plugins/MPEG2/index.html

--------------------
MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask
Windows7/8 Codec Chooser
All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3
 
    Top
videocrack
Posted: Feb 10 2013, 01:19 PM


Member


Group: Members
Posts: 27
Member No.: 26678
Joined: 27-December 09



thank you dloneranger, I'll have a look at it and try to understand smile.gif
 
     Top
phaeron
Posted: Feb 16 2013, 07:41 PM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



Frame-accurate seeking can be done with MPEG streams but it isn't easy. Whether or not this happens is a quality of implementation issue with the decoder.

There are timestamps scattered throughout the stream, but they're at irregular intervals and there isn't a central index to allow for direct seeking. This means that file scanning is necessary to find the timestamps, after which they must be inferred for following frames. Furthermore, there are a variety of hacks that can be done to MPEG streams that will generally work with players but make frame-accurate seeking more difficult, such as splicing. The only fully reliable way to do it is to pre-scan the entire file.
 
    Top
videocrack
Posted: Feb 20 2013, 03:19 PM


Member


Group: Members
Posts: 27
Member No.: 26678
Joined: 27-December 09



QUOTE (phaeron @ Feb 16 2013, 07:41 PM)
Frame-accurate seeking can be done with MPEG streams but it isn't easy. Whether or not this happens is a quality of implementation issue with the decoder.


indeed it is, meanwhile I was able to implement it using appropiate codecs. However, I'm stuck again, this time with audio. The odyssey never ends... sad.gif

I was able to cut the audio of an AVI file into smaller chunks. But merging them turns out to be a rather difficult task. I guess I'll start another thread for that. If you have some time to take a look at it I'd be glad.

Cheers
Stephan
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
4 replies since Feb 9 2013, 11:40 PM Track this topic | Email this topic | Print this topic

<< Back to General programming