Friday, September 4, 2020

Transferring MiniDV Tapes to Linux

Downloading miniDV tapes from my Sony DCR-TRV22 camcorder to my Fedora 32 Linux system with a Thunderbolt 3 port was easy, using dvgrab and a couple of Apple converters to go from FireWire to Thunderbolt 3.

Many years ago I transferred all my VHS home videos to disk through the somewhat painful process of first recording them onto DVDs using a DVD recorder, then ripping the DVDs on my computer. My next video transfer project was to transfer my more recent home videos from miniDV to disk. There was always other work to do, and transferring the tapes was never a critical task, so it was easy to put off. I was thinking it probably would be time consuming but not too difficult, since my Linux computer had an IEEE 1394 (FireWire) port, so I wasn't too worried about it.

When the lockdown started earlier this year, that presented a good opportunity for me to start my tape transfer project. I grabbed my miniDV camcorder and my box of tapes, then went to get a cable to connect the camcorder to my computer. It was only then that I remembered that I upgraded to a new computer at the beginning of this year and gave away the old computer. The old computer, from 2010, had the IEEE 1394 port, the but new one did not. Oops! I waited a bit too long for this supposedly easy job.

My new computer has a ton of ports of various flavors, so it seemed possible that it might still work, if I could get the right cables and converters. After some digging, it looked like it should be possible to use the USBC Thunderbolt port on my new computer. But I couldn't find much support for whether it would work when run through converters on a current version of Linux. The required converters are pretty expensive, but I decided to take a chance and buy them.

My Sony DCR-TRV22 camcorder has a 4-pin FireWire 400 jack, and I had FireWire 400 to 800 cable. I purchased an Apple Thunderbolt to FireWire Adapter for $29 and an Apple Thunderbolt 3 (USB-C) to Thunderbolt 2 Adapter for $49, and for good measure I also purchased a FireWire 400 to 800 Adapter for $10 (in case I had to use a different cable), which I ended up not using. I connected the cable to the camcorder, connected the other end of the cable to the FireWire to Thunderbolt adapter, plugged the FireWire to Thunderbolt adapter into the Thunderbolt 2 to Thunderbolt 3 adapter, and plugged the Thunderbolt 2 to Thunderbolt 3 adapter into the USBC Thunderbolt 3 port on my computer. Then I ran dvgrab, which I had installed earlier. And... it did not see the camera. Rats.
# lsmod | grep -i fire
  (nothing)
# lspci | grep -i fire
  (nothing)
Fortunately, it turned out to be an easy fix. I was able to determine that the Thunderbolt to FireWire adapter was visible by looking in /sys/bus/thunderbolt:
# cat /sys/bus/thunderbolt/devices/0-3/device_name
  Thunderbolt to FireWire Adapter
I found the solution in an Ubuntu bug report: the Thunderbolt device had to be authorized. (Note that your device number might be different.)
# cat /sys/bus/thunderbolt/devices/0-3/authorized
  0
# echo 1 > /sys/bus/thunderbolt/devices/0-3/authorized
# lspci | grep -i fire
  40:00.0 FireWire (IEEE 1394): LSI Corporation FW643 [TrueFire] PCIe 1394b Controller (rev 08)
# lsmod | grep -i fire
  firewire_ohci          45056  0
  firewire_core          81920  1 firewire_ohci
  crc_itu_t              16384  1 firewire_core
At this point I was able to insert a tape into the camcorder and test it:
$ dvgrab foo-
This created the file foo-001.dv. By installing the mediainfo program, I was able to see the datestamp of the recording:
$ mediainfo foo-001.dv | grep date
  Recorded date                            : 2015-12-25 10:32:28.000
The actual command I used to download the tape is:
$ dvgrab --autosplit --timestamp --size 0 --rewind --showstatus dv-
At this point I could just put a tape in the camcorder, rewind it, run the above dvgrab command, come back an hour or so later when it was done, then put in the next tape and repeat. It took a long time to get through all my miniDV tapes, but not much work.