UP  |  HOME

VHS Capture

Table of Contents

TODO

DN-300 Capture

DN-300 recording has advantage of being a standalone device, and recording setup is fairly simple and straight-forward. Disadvantages are no upscaling is minimal upscaling, no VBI (vertical blanking interval) capture, and any adjustments must be done after capture.

Physical Setup

dn300_vhs_capture.svg

Configuration and Recording

The DN-300 can record DV files from analogue video sources, Composite CVBS, S-Video (Y/C) or Component Video (YUV (YPbPr)). It is not possible to record M2T (HDV) files from an analogue video input.

Recording a track

  • Disconnect any DV/Firewire input to avoid interference.
  • Set the analog input in Video Input Source menu
  • Set to record .DV (RAW DV) in Record Formats menu
  • Press the Analog Input button so that it is illuminated. You should see the video source on your output monitor.
  • Use the Next / Previous buttons to select an empty track from the DN-300 track list (shows a duration of 00:00:00:00)
  • Press both the Record and Play/Pause buttons simultaneously and the DN-300 should start recording.

The counter should start counting and the REC symbol should appear

You can pause/resume a track recording, but once a track is stopped you must select a new empty track to record again.

Combining output files

Combine files with ffmpeg.

First create a text file with a list of the input files as below:

Listing 1: video.txt
file '/path/to/file/dv01.dv'
file '/path/to/file/dv01_01.dv'
file '/path/to/file/dv01_02.dv'
file '/path/to/file/dv01_03.dv'
file '/path/to/file/dv01_04.dv'
file '/path/to/file/dv01_05.dv'
file '/path/to/file/dv01_06.dv'

Then run

ffmpeg -f concat -safe 0 -i video.txt -c copy video.avi

Or all at once, something like:

find ./ -type f -name '*.dv' -printf "file '%p'\n" | sort -n > video.txt; ffmpeg -f concat -safe 0 -i video.txt -c copy video.avi

Re-encoding

I re-encode with handbrake gui. It makes it easy to adjust cropping. I just stick with mkv/h264/aac for container/video/audio. Source is likely 29.97 FPS so maintain that. Enable decomb/deinterlace to remove interlacing artifacts.

Or here's how I tried it with ffmpeg. -ss and -to specify timestamps. I used seconds based on ffplay's output. Then crop is specified as a width and height followed by starting position from top left (w:h:x:y). I attempted to produce a hardware encode version, but couldn't figure out how to apply the crop filter so it would work.

Note: crop may differ from the display picture because the crop is applied to the stored image, not based on the display aspect ratio.

ffmpeg -i input.avi -ss 8 -to 2563 -vf "crop=709:473:12:0,yadif=mode=1" -c:v libx264  -crf 18 -preset slower -c:a libopus output.mkv

Cut video (unnecessary with ffmpeg examples above)

Using mkvmerge (if you use mkv container) you can split the final encoded output. Note that splits must happen at keyframes so timestamps may not match the result.

The example below has two splits, and creates 3 files.

mkvmerge --split timestamps:00:00:40.000,02:22:25.000 -o final_file.mkv video.mkv

Scaled via CenterStage CS-2

Scaled via Tendak Video Converter

Closed Captions

Capturing the vertical blanking interval

Most analog-digital converters seem to drop the whole vertical blanking interval. Best results have been with TV capture cards that either include it in the video signal, or have a separate facility for handling VBI data, but I haven't actually succeeded in a usable result.

Device Result
Plextor PX-AV100U Captures at least part of the VBI in the video stream.
Hauppauge WinTV HVR-1800 Separate vbi device, my CC signal seems to end up on line 20 (see zvbi)

Using ccextractor

No luck yet

zvbi

With a supported card you can use zvbi-ntsc-cc to decode closed captions from the vbi device.

I had some trouble with zvbi and something about my setup. I found out my CC signal was on line 20 using the test/osc utility (part of the zvbi source tarball, but not usually packaged). I eventually narrowed this down to my VCR (Mitsubishi MD3000).

I made these changes to get it working with my current setup, but I did not test for a minimal changeset. These also broke some tests which made building a debian package difficult, but I just removed a bunch of asserts in the failing test to get debuild to finish.

Listing 2: zvbi 0.2.35-16 (Debian) diff
--- a/contrib/ntsc-cc.c
+++ b/contrib/ntsc-cc.c
@@ -1,4 +1,4 @@
-/* cc.c -- closed caption decoder
+/* cc.c -- closed caption decoder
@@ -907,11 +907,11 @@
                if ((unsigned int) *n_lines_out >= max_lines)
                        return 1; /* ok */

-               if (V4L2_SLICED_CAPTION_525 == s->id && 21 == s->line) {
+               if (V4L2_SLICED_CAPTION_525 == s->id && 20 == s->line) {
                        sliced_out->id = VBI_SLICED_CAPTION_525;

                        if (0 == s->field)
-                               sliced_out->line = 21;
+                               sliced_out->line = 20;
                        else
                                sliced_out->line = 284;
@@ -1726,7 +1726,7 @@
                              sliced[i].line, c1, c2);
                   /* No need to check sliced[i].id because we
                      requested only caption. */
-                  if (21 == sliced[i].line) {
+                  if (20 == sliced[i].line) {
                      field = 0;
                      caption_filter (c1, c2);
                      if (!in_xds[field]) { /* fields swapped? */
--- a/src/raw_decoder.c
+++ b/src/raw_decoder.c
@@ -162,7 +162,7 @@
                "Teletext System B 525",
                VBI_VIDEOSTD_SET_525_60,
                { 10, 272 },
-               { 21, 284 },
+               { 20, 284 },
                10500, 5727272, 5727272, /* 364 x FH */
                0x00AAAAE4, 0xFFFF, 18, 6, 34 * 8, VBI_MODULATION_NRZ_LSB,
                0,
@@ -171,7 +171,7 @@
                "Teletext System C 525",
                VBI_VIDEOSTD_SET_525_60,
                { 10, 272 },
-               { 21, 284 },
+               { 20, 284 },
                10480, 5727272, 5727272, /* 364 x FH */
                0x00AAAAE7, 0xFFFF, 18, 6, 33 * 8, VBI_MODULATION_NRZ_LSB,
                0,
@@ -180,7 +180,7 @@
                "Teletext System D 525",
                VBI_VIDEOSTD_SET_525_60,
                { 10, 272 },
-               { 21, 284 },
+               { 20, 284 },
                9780, 5727272, 5727272, /* 364 x FH */
                0x00AAAAE5, 0xFFFF, 18, 6, 34 * 8, VBI_MODULATION_NRZ_LSB,
                0,
@@ -200,8 +200,8 @@
                VBI_SLICED_CAPTION_525_F1,
                "Closed Caption 525, field 1",
                VBI_VIDEOSTD_SET_525_60,
-               { 21, 0 },
-               { 21, 0 },
+               { 20, 0 },
+               { 20, 0 },
                10500, 1006976, 503488, /* 32 x FH */
                /* Test of CRI bits has been removed to handle the
                   incorrect signal observed by Rich Kandel (see
@@ -226,7 +226,7 @@
                "2xCaption 525",
                VBI_VIDEOSTD_SET_525_60,
                { 10, 0 },
-               { 21, 0 },
+               { 20, 0 },
                10500, 1006976, 1006976, /* 64 x FH */
                0x000554ED, 0xFFFF, 12, 8, 4 * 8,
                VBI_MODULATION_NRZ_LSB, /* Tb. */
@@ -235,7 +235,7 @@
                VBI_SLICED_VBI_525, "VBI 525", /* Blank VBI */
                VBI_VIDEOSTD_SET_525_60,
                { 10, 272 },
-               { 21, 284 },
+               { 20, 284 },
                9500, 1510000, 1510000,
                0, 0, 0, 0, 10 * 8, 0, /* 9.5-1 ... 62.4+1 us */
                0,