Implementing fast editing with IWMSyncReader
From: VeronicaK (vkravchenko_at_servecast.com)
Date: 07/21/04
- Next message: Marc [MSFT]: "RE: encoding hiss using windows media sdk"
- Previous message: moisesmsm: "Displaying device's property pages"
- Next in thread: VeronicaK: "Re: Implementing fast editing with IWMSyncReader"
- Reply: VeronicaK: "Re: Implementing fast editing with IWMSyncReader"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 21 Jul 2004 09:38:34 -0400
I am trying to implement fast editing as it was described in WMF SDK
article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmform95/htm/readingfileswiththesynchronousreader.asp
All I want is to cut the beginning of the video file. The mark in point
should be at precise time, i.e. not a key frame.
I have tried four different approaches (none of them successfully):
A:
- use SetReadStreamSamples to return compressed samples
- SetRange of SyncReader
- Read up samples till the sample I want to start with
- use SetReadStreamSamples to return decompressed samples
- Write decompressed samples with IWMWriter.WriteSample
- just before first key frame is reached use SetReadStreamSamples to set
it back to compressed samples
- continue writing with into the same writer using
IWMWriter.WriteStreamSample
B:
- Use SetRange of SyncReader
- Write decompressed samples into the temporary file, stopping and closing
the temporary file just before fist key frame is reached
- Open temporary file with second SyncReader and write compressed samples
to the output file
- use SetReadStreamSamples to return compressed samples from the first
reader
- write compressed samples from the first reader to the output file
C:
- Find a key frame which precedes the frame I want to start with and write
it (compressed) into the output file
- use SetReadStreamSamples to return decompressed samples
- continue with plan B %)
D:
- use the same procedure as in B or C to produce two files: first very
shot, containing results decompression exercise till the first key frame,
second one created just by copying compressed samples starting from key
frame in question
- merge them using wmvappend sample from WMF SDK
None of the attempts was successful (talking about video, audio is fine):
A: returned inconsistent results. It seemed that the problem was with
IWMWriter who did manage to mix up the sample time (i.e. later sample had
early time in the output file), so I would get a bunch of errors if I
opened the file in WM ASF View. If I use the same file and the same start
time, the result (number and timestamps of errors) would be different from
one program run to another.
B: worked fine for some clips, but for the others the second part might be
sort of shifter, as if samples were arriving in the wrong order, no errors
in WM ASF View though.
C: again, worked fine for some clips, but sometimes the clip would not
start at all in the WM Player (would play OK if change the position with
the slider) or the first part would be messed up.
D: the results were exactly the same as per B and C, depending on the way
first file was created.
Any clues or ideas of what I am doing wrong?
Thanks in advance
- Next message: Marc [MSFT]: "RE: encoding hiss using windows media sdk"
- Previous message: moisesmsm: "Displaying device's property pages"
- Next in thread: VeronicaK: "Re: Implementing fast editing with IWMSyncReader"
- Reply: VeronicaK: "Re: Implementing fast editing with IWMSyncReader"
- Messages sorted by: [ date ] [ thread ]