-
Notifications
You must be signed in to change notification settings - Fork 26
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 image after converting RawImage to System.Drawing.Bitmap #69
Comments
First thing I'd try is a diffent pixel format instead of Format24bppRgb, 32bpp being the obvious one. If the image looks correct but has a slice curt off then you have the Stride wrong. |
Is it a right way to calculate expected Stride, then convert it to bitmap int expectedStride = rawImage.Width * 3; |
After implementing above code, now getting black and white frame in both (own video and remote video) Still remote video is distorted. |
Can you paste in some images with the options you applied to them. |
Please find the video in the attachment. Bitmap image = new Bitmap(rawImage.Width, rawImage.Height, rawImage.Stride, PixelFormat.Format24bppRgb, rawImage.Sample); |
Is the remote video meant to be the same as Local video? In the remote video there seem to be a few frames that are good. Is that the case? |
Yes, remote video is same as local.
Yes, few frames are good from remote.
…On Sun, Jan 21, 2024, 4:56 PM Aaron Clauson ***@***.***> wrote:
Is the remote video meant to be the same as Local video?
In the remote video there seem to be a few frames that are good. Is that
the case?
—
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUV2TBZVZG32UMGDYWY5XTYPTX65AVCNFSM6AAAAABB6FS7KWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGU4TEMZQGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
If there is even a single good frame coming through then it's not an encoding issue. More likely there are packets being dropped and key frames are missing. Try reducing the frame rate and/or resolution and see if you can get a stable video stream. After that you can gradually increase to see where the problem starts. |
I've adjusted the frame rate to 15 using the following code in the InitialiseDecoder method of the FFmpegVideoEncoder class, but I'm still experiencing the same outcomes. _decoderContext->time_base.den = 15; The remote video, which we're receiving through the Janus media server, seems to be having issues. However, the local video is functioning well with the default frame rate of 30. Publishing video with following code: var videoTrack = new MediaStreamTrack( _pub_peerConnection.addTrack(videoTrack); _pub_peerConnection.OnVideoFormatsNegotiated += (formats) => |
We're currently setting up a new object called FFmpegVideoEndPoint(). Inside the constructor of FFmpegVideoEndPoint, it is creating another object of class FFmpegVideoEncoder. In the InitialiseDecoder method of the FFmpegVideoEncoder class, we're observing the following settings: Bit Rate: 200000 After running the code ffmpeg.avcodec_open2(_decoderContext, codec, null).ThrowExceptionIfError();, our settings change to: Bit Rate: 200000 This leads me to a few questions:
I'd appreciate any insights or suggestions you might have on these points. Thanks for your help! |
We are currently receiving the bit rate dynamically from another client. |
Can you try using PR #62 ? It allows dynamic bitrate by reloading the encoder. (FFmpeg Encode/VP8 Variable Bitrate explanation) |
I am using SIPSorceryMedia.FFmpeg as a media library and Janus as media Server.
When I am converting the RawImage of Publisher's Camera feed got from event OnVideoSourceRawSampleFaster to System.Drawing.Bitmap image = new Bitmap(rawImage.Width, rawImage.Height, rawImage.Stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, rawImage.Sample), converted image is OK.
But when I am converting the RawImage of Subscriber's feed got from event OnVideoSinkDecodedSampleFaster to System.Drawing.Bitmap image = new Bitmap(rawImage.Width, rawImage.Height, rawImage.Stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, rawImage.Sample), converted image is distorted.
Please provide me some clue to solve the issue.
The text was updated successfully, but these errors were encountered: