bytedeco/javacv

FFmpegFrameGrabber missed packet problem

Open

#1,420 opened on May 6, 2020

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Java (1,583 forks)batch import
help wantedquestion

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hello, I'm trying to capture and display rawvideo stream via sdp file. There is a perfect solution with the command line but when the process is done through java ffmpegframegrabber, packet loss occurs. Same SDP file, same parameters but i dont understand what is the difference...

Here is the command line ffmpeg; ffmpeg -v debug -re -probesize 32 -buffer_size 500000 -protocol_whitelist file,rtp,udp -strict -2 -i test.sdp -pix_fmt yuv420p -f sdl "TEST" or ffplay -protocol_whitelist file,udp,rtp -strict -2 -i test.sdp

And Java Code;

    grabber = new FFmpegFrameGrabber("/var/tmp/test.106.sdp");
	grabber.setVideoOption("strict", "-2");
	grabber.setOption("protocol_whitelist", "file,udp,rtp");
	grabber.setVideoOption("buffer_size", "500000");
	grabber.setVideoOption("probesize", "32");
    try {
    	grabber.start();
        while (true) {
        	frame = grabber.grab();
            canvas.showImage(frame);
            grabber.flush();
            Thread.sleep(INTERVAL);
        }

I tried add grabber.setOption("threads", "64"); and grabber.flush(); but nothings changed.

Here is the log;

[sdp @ 0x29aaa00] RTP: missed 1545 packets
[sdp @ 0x29aaa00] Missed previous RTP Marker
[sdp @ 0x29aaa00] max delay reached. need to consume packet

When I researched the problem on the internet, I came across suggestions to increase the buffer size, but I did not get any results although I tried.

Does anyone know about this issue?

Osman

Contributor guide