[mythtv] MythTV Recording System Future

Torbjörn Jansson torbjorn.jansson at mbox200.swipnet.se
Mon Jul 21 21:33:02 EDT 2003

> On Sunday 20 July 2003 10:12 am, Torbjörn Jansson wrote:
> > I have started to write a directshow filter, I tried to use 
> a DMO first but
> > that was too limited to make it work.
> > I can open .nuv files with mpeg4 encoded video and mp3 or 
> uncompressed
> > audio.
> > Rtjpeg is not implemented yet and it can't seek yet.
> > I haven't been able to test hardware mjpeg since I don't 
> have that kind of
> > card, maybe someone have a short sample file?
> > 
> > The filter doesn't decompress the video or audio, that’s done by for
> > example the normal windows divx codec and mp3 codec.
> > For some reason that I haven't figured out yet directshow 
> doesn't like to
> > connect the video output to the divx codec automaticaly.
> Might it be easier to just include libavcodec to do the 
> decoding (it's been 
> ported to windows for other projects), as then you wouldn't 
> have to worry 
> about mjpeg or this?  You're going to have to include the 
> rtjpeg stuff 
> anyway, so...

It's actually good that the filter don't do any decompression since that
allows you to convert the .nuv file to .avi or any other format that
directshow supports without having to recompress it.
I haven't decided yet if I'm going to include the rtjpeg stuff in this
filter or do a separate filter for it.

I found the problem that made the video codec not connect automatically, I
accidentally mixed up the media types, I'm surprised that it worked at all

> > In directshow I need to create timestamps on all samples 
> (IMediaSample,
> > both audio and video) shoud I use the 
> rtframeheader::timecode or count
> > frames and use the sync frames? Video frame number woud be 
> something like
> > last_videosync_timecode+current_keyframe
> >
> > I don't think I got the timestampin entierly right because 
> after a few
> > minutes on one of my test files the audio and video gets 
> realy out of sync.
> > The audio and video is synced fine until that point in the file.
> You should use the timestamps that are in the frameheaders, 
> no counting.  The 
> audio timestamps need to be adjusted by the 'effdsp' variable (see 
> AudioOutputOSS::AddSamples()) for it to sync up properly.  effdsp is 
> basically the actual rate the soundcard recorded at for the 
> given time 
> period, instead of what you requested -- soundcards aren't 
> very accurate, and 
> the sample rate floats around a bit.  The 'timecode' member 
> of the frame 
> header contains this information on every audio sync 
> (frametype = S, comptype 
> = A) frame.

I found the problem with audio and video getting really out of sync after
about 3 minutes, I missed a typecast so when I converted the timestamps I
got negative time after a while and that really confused the other filters.

I have started to implement seeking. The "RTjjjjjjjjjj" frame header is the
same as a seek point? So the following video shod be a keyframe, right?
If so, it can be used to build a seektable if its missing?

At every seek point there is a string "FFmpeg0.4.6b4669" in the video data
that follows, maybe that’s what makes the video sometimes look corrupted
(like when you have avi files with errors in it) it looks like corrupted
blocks moving around and then quickly disappearing.
So maybe ffmpeg inserts some extra data, I guess I'll have to take a closer
look at how ffmpeg works.

More information about the mythtv-dev mailing list