bytedeco/javacv

RTSP video is distorted with FFmpegFrameGrabber

Open

#2.222 aberto em 23 de abr. de 2024

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)Java (1.583 forks)batch import
help wantedquestion

Métricas do repositório

Stars
 (6.985 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

When using FFmpegFrameGrabber with a wifi camera, the images can have lots of artifacts. here's an example: Screenshot_20240417_151528_TRUCE

this is the code I am using

FFmpegLogCallback.set()
log("attempting connection to $url")
val grabber = FFmpegFrameGrabber(url)
grabber.imageHeight = 480
grabber.imageWidth = 848
grabber.format = "rtsp"
grabber.videoCodecName = "h264_mediacodec"
grabber.frameRate = 30.0
grabber.sampleRate = 30
grabber.start()
while (alive) {
    val frame = grabber.grabImage()
    showPreview(frame)
}

I'm wondering if there are any tweaks that can clean the video up a bit / handle missed packets better? Specifying TCP with

grabber.options["rtsp_transport"] = "tcp"

makes the image cleaner but I am running into another issue where the video stops after 30 seconds: https://github.com/bytedeco/javacv/issues/2218

Guia do colaborador