Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting distorted images - possible error in decoder format? #71

Open
MarcinMroczkowski-Reakto opened this issue Jan 29, 2024 · 2 comments

Comments

@MarcinMroczkowski-Reakto

Hello. I am using this decoder to decode video stream coming from Janus WebRTC. Now, it works, that means, it receives frames and decodes them, but the problem is, i am getting very distorted images.
This is incoming stream configuration in Janus:

rtp-sample101: {
        type = "rtp"
        id = 101
        description = "herelink"
        metadata = "You can use this metadata section to put any info you want!"
        audio = false
        video = true
        videoport = 5101
        videopt = 96
        videortpmap = "H264/90000"
        secret = "adminpwd"
}

Now, i set up the ffmpeg endpoint to decode this incoming stream:

VideoFormat videoFormat = new(96, "H264");
           _videoSink.RestrictFormats(format => format.Codec == VideoCodecsEnum.H264);
            _videoSink.SetVideoSinkFormat(videoFormat);`
           _videoSink.SetVideoSourceFormat(videoFormat);

Then, i save this frame to file:

Mat imageMatrix = new Mat((int)height, (int)width, DepthType.Cv8U, 3);
imageMatrix.SetTo(sample);`
Image<Rgb, byte> image = imageMatrix.ToImage<Rgb, byte>();
Console.WriteLine("creating photo...");
image.Save($"MIS_{missionId}_photo_{photoCount + 1}.jpg");

The above code is implemented using Emgu.CV, I get following image no matter if i use Rgb or Bgr format, it is always distorted:

MIS_1_photo_1
Now, i do not really know where is the problem. Is it a problem with incorrect format? Does ffmpeg need to include h264 library? or is this the problem with actual decoding?

@MarcinMroczkowski-Reakto
Copy link
Author

Follow-up explanation: Only the topmost part of the photo appears correct.

@MarcinMroczkowski-Reakto
Copy link
Author

This photo is better, but still distorted:
MIS_1_photo_28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant