Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get datestamp from DV capture

372 views
Skip to first unread message

Christopher

unread,
May 9, 2002, 10:18:53 AM5/9/02
to
I'm trying to retrieve the DATE/TIME information which I know is available
in the DV stream from a Sony DV Handycam, and which I have seen other
software retrieve successfully. For the life of me I cannot find any
documentation in DirectShow SDK or on the net showing me how.

Everything in the code is working as advertised, including retrieval of the
timecode below. I had expected that the datestamp would be in the userbits
(.timecode.dwUser). But it isn't. Am I looking in the wrong place?

IAMTimecodeReader *mTimeCoder = (previously set and working);

TIMECODE_SAMPLE tcs;
tcs.dwFlags = ED_DEVCAP_TIMECODE_READ;
mTimeCoder->GetTimecode(&tcs);

timecode is in tcs.timecode.dwFrames.

Thanks in advance.

Chris


The March Hare

unread,
May 9, 2002, 11:32:05 AM5/9/02
to
I haven't done this myself yet, but I think you need to use a raw device
command via IAMExtTransport::GetTransportBasicParameters(sounds like
fun--even the method name is confusing). See the DX 8.1 docs "Issuing Raw
AV/C Commands" which gives an example of sending a seek command in raw
format which is used in the DVapp sample. The raw commands are documented
at www.1394ta.org.


"Christopher" <c...@softhome.net> wrote in message
news:#bba1R29BHA.1940@tkmsftngp04...

Christopher

unread,
May 10, 2002, 1:24:51 PM5/10/02
to
Thanks for the very informative pointer. I got the AV/C docs and was able to
make several raw commands work, like getting timecode. Frustratingly, there
is a "RECORDING DATE" documented, but my Sony DV camera comes back with Not
Implemented. However, I *know* that my set up does have datestamp coming
through.

So either this is still the wrong place to look, or I'm missing something
fundamental, because I now have more information yet am more confused.
Perhaps I have to go to the ioctl level? Does msdv.sys mask something it
shouldn't?

If I ever get this to work I'll post the code fragments. I'd thought
everyone and his brother had done this already.

Thanks.

"The March Hare" <ph...@ndsm.maps> wrote in message
news:#i9iy629BHA.2304@tkmsftngp04...


> I haven't done this myself yet, but I think you need to use a raw device
> command via IAMExtTransport::GetTransportBasicParameters(sounds like
> fun--even the method name is confusing). See the DX 8.1 docs "Issuing Raw
> AV/C Commands" which gives an example of sending a seek command in raw
> format which is used in the DVapp sample. The raw commands are documented
> at www.1394ta.org.
>
>

> "Christopher" wrote in message

The March Hare

unread,
May 10, 2002, 2:30:56 PM5/10/02
to
Cool. I'll be interested in what you post. That's one of the roads I need
to go down soon. Did you figure out how to get relative timecode on DV (I
think that is time within the current track)?

"Christopher" <ctn_spam_...@softhome.net> wrote in message
news:OvQ4rgE#BHA.2080@tkmsftngp05...

Christopher

unread,
May 11, 2002, 1:39:33 PM5/11/02
to
Duh! I had the flash of insight (!) to look at the DV data stream itself
with my filter, rather than messing with device controls. The date stamp is
right there in the Vaux data fields, repeated 300 times a second!

Here's the fragments as promised.

typedef struct {
BYTE bytes[80];
} DV_DIFBlock;

typedef struct {
DV_DIFBlock header[1];
} DV_Header;

typedef struct {
DV_DIFBlock subcode[2];
} DV_Subcode;

typedef struct {
DV_DIFBlock skip[2];
BYTE skip48[48];

BYTE magic_60;
BYTE magic_FF_1;
BYTE magic_FF_2;
BYTE PAL20;
BYTE magic_FF_3;

BYTE magic_61;
BYTE magic_33;
BYTE aspect_16x9_CF;
BYTE magic_FD;
BYTE magic_FF_4;

BYTE magic_62;
BYTE magic_FF_5;
BYTE day:5; //max = 0x31
BYTE msb_day:3;
BYTE month:5; //max = 0x12
BYTE msb_month:3;
BYTE year; //max = 0x99

BYTE magic_63;
BYTE magic_FF_6;
BYTE second:6; //max = 0x59
BYTE msb_second:2;
BYTE minute:6; //max = 0x59
BYTE msb_minute:2;
BYTE hour:6; //max = 0x23
BYTE msb_hour:2;

BYTE skip12[12];
} DV_Vaux;

typedef struct {
DV_DIFBlock bytes[144];
} DV_AVData;

typedef struct {
DV_Header header;
DV_Subcode subcodes;
DV_Vaux vaux;
DV_AVData avdata;
} DV_DIFSequence;

typedef DV_DIFSequence DV_Frame_NTSC[10];
typedef DV_DIFSequence DV_Frame_PAL[12];

... in CMyInputPin::Receive(IMediaSample *pSample)

hr = pSample->GetPointer(&pbData);
if (FAILED(hr)) {
return hr;
}

#define BCD(x) (((x & 0xf0) >> 4) * 10 + (x & 0x0f))
DV_Frame_PAL *frame = (DV_Frame_PAL *) pbData;
DV_DIFSequence *s0 = frame[0];
int year = BCD(s0->vaux.year);
int month = BCD(s0->vaux.month);
int day = BCD(s0->vaux.day);
int hour = BCD(s0->vaux.hour);
int minute = BCD(s0->vaux.minute);
int second = BCD(s0->vaux.second);

...


Henrik Lynge

unread,
May 12, 2002, 6:57:27 PM5/12/02
to
Thanks for teh fragment, but !!!!
Sorry to ask as I am new to Directx I have to know what is the definition of
the
CMyInputPin, and how do I adress it.
I would like to make a simple test with a button that got the recording
date/time and printed it to the screen...
Please help me.

TIA.

"Christopher" <ctn_spam_...@softhome.net> wrote in message

news:uU9ESLR#BHA.2396@tkmsftngp05...

> BYTE day:5; file://max = 0x31
> BYTE msb_day:3;
> BYTE month:5; file://max = 0x12
> BYTE msb_month:3;
> BYTE year; file://max = 0x99
>
> BYTE magic_63;
> BYTE magic_FF_6;
> BYTE second:6; file://max = 0x59
> BYTE msb_second:2;
> BYTE minute:6; file://max = 0x59
> BYTE msb_minute:2;
> BYTE hour:6; file://max = 0x23

Henrik Lynge

unread,
May 13, 2002, 2:19:10 PM5/13/02
to
What is going on here :

BYTE day:5; file://max = 0x31

sorry, can't read that....
Please help
TIA


"Christopher" <ctn_spam_...@softhome.net> wrote in message
news:uU9ESLR#BHA.2396@tkmsftngp05...

> BYTE day:5; file://max = 0x31
> BYTE msb_day:3;
> BYTE month:5; file://max = 0x12
> BYTE msb_month:3;
> BYTE year; file://max = 0x99
>
> BYTE magic_63;
> BYTE magic_FF_6;
> BYTE second:6; file://max = 0x59
> BYTE msb_second:2;
> BYTE minute:6; file://max = 0x59
> BYTE msb_minute:2;
> BYTE hour:6; file://max = 0x23

The March Hare

unread,
May 13, 2002, 5:27:21 PM5/13/02
to
Henrik,

I'm guessing it's a C++ comment (//) that the email program thought was a
file URL so prefixed "file:" giving the odd result. Just delete the "file:"
part.


"Henrik Lynge" <h...@privat.dk> wrote in message
news:eAwOTwq#BHA.2344@tkmsftngp02...

The March Hare

unread,
May 13, 2002, 5:29:12 PM5/13/02
to
Good insight and thanks for sharing the code. Unfortunately, I need to know
the timecode before playing the media stream, so I'll have to dig into that.
In particular, I'm interested in the relative time within the current track
(at least on some DV Camcorders you get this in the display on the
camcorder).

"Christopher" <ctn_spam_...@softhome.net> wrote in message
news:uU9ESLR#BHA.2396@tkmsftngp05...

Christopher

unread,
May 14, 2002, 9:31:50 AM5/14/02
to
Right... I wasn't sure what you meant by "relative timecode" and how that's
different from "raw" timecode. I know I've been getting timecodes like this,
but is this what you wanted?

SUCCEED_OR_RELEASE(mCaptureGraphBuilder->FindInterface(&PIN_CATEGORY_CAPTURE
,
&MEDIATYPE_Video,
mBaseFilter,
IID_IAMTimecodeReader,
(void
**)&mTimeCoder));
... elsewhere ...

TIMECODE_SAMPLE tcs;
tcs.dwFlags = ED_DEVCAP_TIMECODE_READ;
mTimeCoder->GetTimecode(&tcs);

timecode is in tcs.timecode.dwFrames

"The March Hare" <ph...@ndsm.maps> wrote in message
news:OTPM8Us#BHA.2164@tkmsftngp04...

Henrik Lynge

unread,
May 14, 2002, 9:35:08 AM5/14/02
to
Thanks for the help, but
I still dont know the syntax:
day:5
It must be a bit operator, but what kind shift-left, shift-right or what
??????

any help is good help

TIA
Henrik Lynge

"The March Hare" <ph...@ndsm.maps> wrote in message

news:e8LM6Ts#BHA.1828@tkmsftngp05...

The March Hare

unread,
May 14, 2002, 11:07:54 AM5/14/02
to
Henrik,

Sorry about the confusion. It is just a bit field defining the first 5 bits
(the :3 on the next one is the next 3 bits of that byte). It's just so you
don't have to do a lot of bit shifting yourself. My old eyes didn't pickup
on the ":" with the proportional font my OutlookExpress newsreader uses.
The blue "file://" was much easier to see :)

Here's a link to an MS explanation:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang98/ht
ml/_pluslang_c.2b2b_.bit_fields.asp

"Henrik Lynge" <h...@privat.dk> wrote in message

news:uuUNR20#BHA.1828@tkmsftngp05...

The March Hare

unread,
May 15, 2002, 12:04:03 AM5/15/02
to
Thanks. I think I've got enough to get through this one now. Just need to
get the application code written :) At first, I couldn't get the interface
using FindInteface (I was getting E_POINTER), so I went to the friendly COM
pointers and it did the trick:

CComQIPtr<IAMTimecodeReader, &IID_IAMTimecodeReader> timecode_reader;

timecode_reader = m_dx->dv_camera; // CComPtr<IBaseFilter> dv_camera
if (!timecode_reader)
return E_NOINTERFACE;
hr = timecode_reader->GetTimecode(&sample);


"Christopher" <ctn_spam_...@softhome.net> wrote in message

news:Og261u0#BHA.2164@tkmsftngp04...

denni...@lrs.com

unread,
Jan 27, 2005, 3:49:34 PM1/27/05
to
Thanks for posting this info. Where can I get the DV stream data
definitions?

The March Hare [MVP]

unread,
Jan 27, 2005, 5:15:41 PM1/27/05
to
On 27 Jan 2005 12:49:34 -0800, denni...@lrs.com wrote:

> Thanks for posting this info. Where can I get the DV stream data
> definitions?

Try a Google search. I was able to find some decent info that way. IIRC,
there is an open source DV project among other things.


--
Please read this before replying:
1. Learn about newsgroups - http://dev.6581.com/newsgroups.html
2. Trim & respond in-line (please don't top post or snip everything)
3. Benefit others - follow up if you are helped or you found a solution

0 new messages