sipsorcery icon indicating copy to clipboard operation
sipsorcery copied to clipboard

C# media codecs

Open Terricide opened this issue 2 years ago • 8 comments

FYI I was messing with the IKVM project that was just recently updated.

https://github.com/ikvm-revived/ikvm

I then used JCodec.jar file and got it converted to a dll.

https://github.com/jcodec/jcodec

I just successfully wrote a sequence of images to an MP4 file

With no native libraries needed like ffmpeg.

Terricide avatar Jun 01 '22 17:06 Terricide

Here is a screen recoder project as an example. screenrecoder.zip

Terricide avatar Jun 01 '22 17:06 Terricide

Looks very interesting! I take it the video codec was H264? That's no mean feat of the JCodec project if they've implemented H264, VP8 and more in pure Java! Ah, I see VP8 is IFrames only, that's a big shortcut and means it's not practical for streaming :).

Any idea how the H264 converted codec performs with 30fps streaming at 1080p? If we can ever do that in pure dotnet video would be sooo much easier.

sipsorcery avatar Jun 01 '22 17:06 sipsorcery

The test I ran was I believe was encoding h264 to an mp4 file. It was a bit slow in debug mode, taking 200-300 ms per frame at 1920x1080. I'm messing around using (dotnet decompilers) like ILSpy and dotpeek to convert the dll to a project I can compile, then maybe I could figure out how to speed it up some more. Those tools will decompile the dll but there are manual issues I'd need to fix.

Terricide avatar Jun 01 '22 18:06 Terricide

FYI 300x300 takes 10ms on my machine

Terricide avatar Jun 01 '22 18:06 Terricide

Also I wonder if the main page is wrong about being iframes only for vp8 now?

https://github.com/jcodec/jcodec/pull/467/commits

Terricide avatar Jun 01 '22 18:06 Terricide

I converted the dll to source code and it builds and I can pass a sequence of images to create an mp4 file, however the output mp4 plays but isn't rendered correctly. Are you interested in the source code?

Terricide avatar Jun 09 '22 20:06 Terricide

I'm not currently doing any codec work but it's one of those things that's always useful when you need it. Are you planning on putting the source code on GitHub? I'd certainly like to keep a link to it.

sipsorcery avatar Jun 12 '22 18:06 sipsorcery

Yeah I plan to, I'll put the link here. I've just been messing around with different decompilers, different versions of ikvm and then even going back to the original java to do some file by file comparison.

Terricide avatar Jun 22 '22 15:06 Terricide