Wednesday, July 02, 2008

Get Current Position On Encoding in Directshow

When doing encoding in directshow, getting the current position (needed when you want to show progress of current encoding process) is not as obvious as for playing. I try to use the code from playing operation first i.e: get IMediaSeek interface and do GetDuration and GetCurrentPosition, but the progress is very inaccurate. The graphedit behave inaccurately also.

I found the solution later after some browsing around in Directshow help. To summarize, the solution/explanation :

IMediaSeek you got from Graph only accurate for playing operation. For file related e.g: on encoding operation, get IMediaSeek from AVIMux instead of the Graph.
The rest are the same with playing.

1 comment:

Anonymous said...

Very helpful. Have been looking for the answer for an hour.