Re: Can't get kino or dvgrab to work

Stefan Richter <[email protected]> Tue, 20 Oct 2009 20:28:04 +0200 (CEST)
Newsgroups gmane.comp.video.kino.devel
Message-ID <[email protected]>
On 20 Oct, Dan Dennedy wrote:
> On Tue, Oct 20, 2009 at 12:30 AM, Stefan Richter
> <[email protected]> wrote:
>> Danny Piccirillo wrote:
>>> I've been trying to capture video from my DV camera but Kino freezes every
>>> time i try (using Ubuntu Karmic by the way), and dvgrab won't grab more than
>>> the first few seconds. dvgrab has at least made some progress and captured a
>>> little bit, but for some reason it stops early.
>>
>> dvgrab stops early for me too (when I tried it the last time), but I can
>> successfully work around that by means of the -noavc option.
> 
> Let's focus on dvgrab for now. My suspicion is that dvgrab believes it
> is at the end of the tape, and -noavc suppresses the ability to detect
> that. I have not reproduced the problem yet. It could be
> device-dependent behavior.

Uh, I left an important fact out of my "report":  Lately I used this
camcorder without a tape inserted, in webcam mode.  (I never ever record
anything, I got this camcorder for nothing else than driver testing.)

So here is what happens:  Without noavc option, dvgrab exits with a
message like

	Found AV/C device with GUID 0x008088030960484b
	Waiting for DV...
	Capture Started
	"dvgrab-010.dv":     0.14 MiB 1 frames timecode 00:00:00.00 date 2009.10.20 18:54:45
	Capture Stopped

if I have no tape inserted.  With tape in it, dvgrab captures the
webcam-mode video stream.  Also, with tape inserted and camcorder in
play mode, dvgrab starts the tape and records.

Kino is a little bit different:  Always shows the live preview, but
records only a single frame file
  - if the camcorder is in webcam mode without tape,
  - if the camcorder is in webcam mode with tape (i.e. tape inserted,
    dial switched to "record", motor paused).
Kino captures only if the dial on the camcorder is switched to play.

And that's the secret why I am somewhat more successful with SBP-2:
HDDs can be either on or off; there aren't as many buttons on them as on
a camcorder.  (For testing, I also have got an IIDC camera without any
buttons at all, which helps.)  #-)

>> Dan had a suggestion for me what I should check in the dvgrab source to
>> narrow down my problem, but I didn't spend the time to do that yet.
> 
> There is a big test in the middle of captureThreadRun() in dvgrab.cc
> around a call to writeFrame(). It would be interesting test for
> someone who is affected by this bug to comment the if lines and call
> writeFrame unconditionally to see if it resolves.

Hmm.  I left the three blocks with "buffer underrun...", "damaged
frame...", and "frame dropped..." intact because these messages were
never printed, and changed the else block thus:

--- dvgrab-3.5.orig/dvgrab.cc
+++ dvgrab-3.5/dvgrab.cc
@@ -1038,27 +1038,7 @@ void DVgrab::captureThreadRun()
 		}
 		else
 		{
-			if ( m_hdv )
-			{
-				writeFrame();
-			}
-			else
-			{
-				DVFrame *dvframe = static_cast<DVFrame*>( m_frame );
-				TimeCode timeCode = { 0, 0, 0, 0 };
-				dvframe->GetTimeCode( timeCode );
-				if ( dvframe->IsNormalSpeed() &&
-				     ( m_jpeg_overwrite ||
-				       !m_avc ||
-				       !m_isRecordMode ||
-				       ( m_isRecordMode &&
-				         strcmp( avc1394_vcr_decode_status( m_transportStatus ), "Recording" ) == 0 &&
-				         !( timeCode.hour == 0 && timeCode.min == 0  && timeCode.sec == 0 && timeCode.frame == 0 )
-				       )
-				     )
-				   )
-					writeFrame();
-			}
+			writeFrame();
 
 			// drop frame on stdout if getting low on buffers
 			if ( !critical_mass && m_raw_pipe )


However, this still did not change anything for the situation that the
camcorder streams live video while no tape is inserted:

$ dvgrab-3.5/dvgrab
Found AV/C device with GUID 0x008088030960484b
Waiting for DV...
Capture Started
"dvgrab-011.dv":     0.55 MiB 4 frames timecode 00:00:00.00 date 2009.10.20 19:13:51
Capture Stopped

As before, -noavc helps:

$ dvgrab-3.5/dvgrab -noavc
Found AV/C device with GUID 0x008088030960484b
Waiting for DV...
Capture Started
^C"dvgrab-012.dv":    32.27 MiB 235 frames timecode 00:00:00.00 date 2009.10.20 19:14:07
Capture Stopped

(I stopped it with Ctrl-C.)
-- 
Stefan Richter
-=====-==--= =-=- =-=--
http://arcgraph.de/sr/


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference