On Fri, 18 Dec 2020 at 18:03, Ram Shaffir <[email protected]> wrote:

> The root of the problem is with the v4l2 driver's buffer:
>
> 'Dequeued v4l2 buffer contains corrupted data (0 bytes).'
>
> and it seems that the v4l2 doesn't clear its buffer as it should in some
> way that affects the video/audio; as a workaround, before every run of the
> ffmpeg need to execute the following to clear the buffer (from this link:
> https://trac.ffmpeg.org/ticket/4988?cversion=2&cnum_hist=1):
>
>
To drop the corrupt packets, you may want to try the attached patch. And
then set -discardcorrupt option.

--
Andriy
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 365bacd771..e961eba64c 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -589,6 +589,11 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
             return AVERROR(ENOMEM);
         }
     }
+#ifdef V4L2_BUF_FLAG_ERROR
+    if (buf.flags & V4L2_BUF_FLAG_ERROR) {
+        pkt->flags |= AV_PKT_FLAG_CORRUPT;
+    }
+#endif
     pkt->pts = buf_ts.tv_sec * INT64_C(1000000) + buf_ts.tv_usec;
     convert_timestamp(ctx, &pkt->pts);
 
_______________________________________________
ffmpeg-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to