Skip to content

Commit 0cadb77

Browse files
committed
2 parents 815b4aa + b21493e commit 0cadb77

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

README.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
11
# H264Sharp
2-
Cisco's OpenH264 C++/CLI wrapper in C# with optimised image format conversions. It is very suitable for realtime streaming.
3-
- Offers managed and unmanaged API.
4-
- Tested on .NetFramework and Net6.
2+
Cisco's OpenH264 C++/CLI wrapper in C# with optimised image format conversions. It is very suitable for realtime streaming over network.
3+
- Offers managed and unmanaged intuitive API.
4+
- Tested on .NetFramework and NetCore(upto 7).
55
- Compatible with OpenCV.(i.e. OpenCVsharp)
66
- Tested on WPF application with camera and screen capture (P2P Videocall).
7+
- No memory leaks or GC pressure with bitmaps.
78
- Simple console application example is provided on repo as an example.
89

910
### Setup
11+
- Default Constructor will look for `openh264-2.3.1-win32.dll` or `openh264-2.3.1-win64.dll` automatically on executable directory depending on process type.
12+
- You can setup with a different dll name, constructor is overloaded.
1013
``` c#
1114
decoder = new H264Sharp.Decoder();
1215

1316
encoder = new H264Sharp.Encoder();
1417
encoder.Initialize(width, height, bps: 3_000_000, fps: 30, H264Sharp.Encoder.ConfigType.CameraBasic);
1518
```
16-
- Empty Constructor will look for 32 or 64 bit openh264 dll automatically on executable directory(i.e. Debug/Release folder of your project).
17-
- You can setup with a different dll name, constructor is overloaded.
1819

1920
### Encode
21+
- You can encode from rgb/rgba/bgr/bgra/yuv_i420 on as raw data format, or System.Drawing.Bitmaps.
22+
- Raw data is compatible with OpenCV Mats or any other standard image container.
23+
- EncodedFrame represents h264 encoded bytes(NALs etc).
2024
```C#
2125
if(encoder.Encode(bitmap, out EncodedFrame[] frames))
2226
{
2327
foreach (var frame in frames)
2428
{
29+
//hints..
2530
//byte[] b = frame.ToByteArray();
2631
//frame.CopyTo(buffer, 0);
2732
Decode(frame.Data, frame.Length, frame.Type);
2833
}
2934
}
3035
```
31-
- You can encode rgb/rgba/bgr/bgra/yuv_i420 on as raw data format or System.Drawing.Bitmaps.
32-
- You have to determine startIndex, width height and stride values for your raw data images.
33-
- Raw data is compatible with OpenCV Mats.
34-
- EncodedFrame represents h264 encoded bytes(NALs etc).
36+
3537

3638
### Decode
39+
- You can decode with pointers or managed byte array as input.
40+
- You can decode into System.Drawing.Bitmaps or raw data format images (they are compatible with OpenCV Mats and any other standard image containers.).
3741
```C#
3842
void Decode(IntPtr data, int length, FrameType type)
3943
{
@@ -46,23 +50,26 @@ Cisco's OpenH264 C++/CLI wrapper in C# with optimised image format conversions.
4650
}
4751
}
4852
```
49-
- You can decode with pointers or managed byte array as input.
50-
- You can decode into System.Drawing.Bitmaps or raw data format images (they are compatible with OpenCV Mats).
53+
5154
# Converter dll
5255
A separate dll is provided for RGB <-> YUV conversions. Its compiled with clang LLVM and has AVX2 intrinsics.
5356
</br>You can optionally include it on your executable path just like Openh264 dll.
5457
</br>
55-
</br>If wrapper could not find the Converter32/64 dll it will fall back to use C++Cli versions.
56-
</br>External dll 2x+ faster than C++Cli convertors.
58+
</br>If wrapper cannot find the Converter32/64 dll it will fall back to use C++/Cli versions.
59+
</br>External dll 2x+ faster than C++/Cli versions.
5760

5861
# TLDR how to install
5962
- Go to my releases find lates version.
60-
- Reference/Include H264Sharp dll on your project.
61-
- Add `openh264-2.3.1-win32.dll` or `openh264-2.3.1-win64.dll` or both to your executable directory. (keep the original names if you want to use default constructor)
62-
- Optionally Add Converter64/32 dlls to your executable directory.
63+
- Reference H264Sharp dll on your project.
64+
- Add `openh264-2.3.1-win32.dll` or `openh264-2.3.1-win64.dll` or both to your executable directory(Or include on your project and ckeck copy to output-> copy if newer).
65+
- Keep the original names if you want to use default constructors.
66+
- Optionally Add Converter64/32 dlls to your executable directory same way as openh264 dll.
67+
- Enjoy
6368
# Remarks
64-
.Net Core and .Net Framework releases are provided.
65-
Use at least 2.3.1 version of openh264.(cisco has updated some data types, older versions might lead to stack buffer overflow).
69+
- Decode callbacks with raw image formats use cached backed buffer, if you wont consume them immediately, make a copy or sync your system.
70+
- Encoder output "EncodedFrame" uses cached back buffer if you wont consume them immediately, make a copy or sync your system.
71+
- .Net Core and .Net Framework releases are provided.
72+
- Use at least 2.3.1 version of openh264.(cisco has updated some data types, older versions might lead to stack buffer overflow).
6673

6774
- Download Cisco's [`openh264-2.3.1-win32.dll`](http://ciscobinary.openh264.org/openh264-2.3.1-win32.dll.bz2)
6875
- Download Cisco's [`openh264-2.3.1-win64.dll`](http://ciscobinary.openh264.org/openh264-2.3.1-win64.dll.bz2).

0 commit comments

Comments
 (0)