pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/48399: multimedia/ffmpeg cannot capture video from /dev/video*



>Number:         48399
>Category:       pkg
>Synopsis:       multimedia/ffmpeg cannot capture video from /dev/video*
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 23 04:30:00 +0000 2013
>Originator:     Nat Sloss
>Release:        pkgsrc-2013Q2
>Organization:
>Environment:
NetBSD beast 6.1.1_PATCH NetBSD 6.1.1_PATCH (PCIPAE) #22: Thu Nov 21 23:13:25 
EST 2013  build@microrusty:/usr/src/sys/arch/i386/compile/obj/PCIPAE i386
>Description:
Ffmpeg cannot capture video from webcam as ioctl G_PARM is unsupported also if 
the webcam supplies an empty frame the encoding exits.
>How-To-Repeat:
Try the following:
ffmpeg -f v4l2 -s 640x480 -r 25 -i /dev/video0 test.avi

You will find that is exits with an error instead of capturing video.
>Fix:
Apply this patch:

$NetBSD$

--- libavdevice/v4l2.c.orig     2013-05-10 00:16:06.000000000 +0000
+++ libavdevice/v4l2.c
@@ -585,6 +585,13 @@ static int mmap_read_frame(AVFormatConte
 
     /* FIXME: Some special treatment might be needed in case of loss of 
signal... */
     while ((res = v4l2_ioctl(s->fd, VIDIOC_DQBUF, &buf)) < 0 && (errno == 
EINTR));
+
+    if (buf.bytesused == 0) {
+       if (buf.m.userptr)
+               enqueue_buffer(s->fd, buf.index);
+       return AVERROR(EAGAIN);
+    }
+
     if (res < 0) {
         if (errno == EAGAIN)
             return AVERROR(EAGAIN);
@@ -771,6 +778,7 @@ static int v4l2_set_parameters(AVFormatC
         tpf = &streamparm.parm.capture.timeperframe;
     }
 
+#ifndef __NetBSD__
     streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
     if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) < 0) {
         ret = AVERROR(errno);
@@ -806,6 +814,7 @@ static int v4l2_set_parameters(AVFormatC
                    "The driver does not allow to change time per frame\n");
         }
     }
+#endif
     s1->streams[0]->avg_frame_rate.num = tpf->denominator;
     s1->streams[0]->avg_frame_rate.den = tpf->numerator;
     s1->streams[0]->r_frame_rate = s1->streams[0]->avg_frame_rate;

Regards,

Nat.



Home | Main Index | Thread Index | Old Index