[FFmpeg-user] Encoding DV tapes with "datecode" preserved for each frame

Dave Rice dave at dericed.com
Mon May 9 02:45:32 CEST 2016

> On May 8, 2016, at 1:40 AM, Francois Visagie <francois.visagie at gmail.com> wrote:
>> -----Original Message-----
>> From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of
>> Martynas Brijunas
>> Sent: 07 May 2016 01:29
>> To: ffmpeg-user at ffmpeg.org
>> Subject: [FFmpeg-user] Encoding DV tapes with "datecode" preserved for
>> each frame
>> Hi,
>> I have a collection of AVI files which were created from DV tapes. Each frame
>> in these AVI files has a "datecode" field which can be seen with a tool like
>> "dvdate". I would like to move my collection from the very bulky AVI files
>> (16GB per tape) to a very manageable MP4. My question is: can the
>> "datecode" field be preserved when transcoding from dvvideo (native) to
>> h264 (libx264)? I am attaching a screenshot of how this "datecode" looks like
>> on one of my files.
> Not saying it isn't possible, but I never managed to do this. It could be that datecode is proprietary DV codec metadata not understood by ffmpeg (at least with the versions I tried).

Here's a sample with recording data and time in the VAUX of the DV encoding: https://archive.org/download/DvAnalyzerSampleDvAudioErrors/dvanalyzer_sample_EVIA_IU.mov <https://archive.org/download/DvAnalyzerSampleDvAudioErrors/dvanalyzer_sample_EVIA_IU.mov>. The VAUX structure is defined in  http://web.archive.org/web/20060927044735/http://www.smpte.org/smpte_store/standards/pdf/s314m.pdf <http://web.archive.org/web/20060927044735/http://www.smpte.org/smpte_store/standards/pdf/s314m.pdf> but this spec doesn't seem to identify or explain the vaux packs for recording date and recording time. 

In the same the first recording date vaux pack is at 129,482 bytes and the first recording time vaux pack is at 129,487 bytes (or 458 and 463 bytes from the start of the dv encoding). There's a rough guide to parsing these to packs at https://groups.google.com/d/msg/microsoft.public.win32.programmer.directx.video/3kMuSYZ-KFw/CKfl0xeZ8FUJ <https://groups.google.com/d/msg/microsoft.public.win32.programmer.directx.video/3kMuSYZ-KFw/CKfl0xeZ8FUJ>, copying the most relevant part here: 
 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;

For the sample the recording date time should be 2004-07-09 13:53:52.

Hope this helps.

> Failing that, you have a couple of alternatives. To help ffmpeg access datecodes, extract them to subtitle text file format with dvdate or similar beforehand, and then try mux them in (converting format if necessary) with ffmpeg during encoding. The other alternative follows from this - extract datecode to subtitle files for your player to render during playback. The latter is what I usually do.
>> Thank you in advance.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-user mailing list