PDA

View Full Version : Recording source in c# examples



Wyvern_010
07-07-2019, 06:33 AM
Hi All!

I have the examples working so far.
I send screenshots to the sender and that all works!

What i can't seem to figure out and cant find any documentation about is how to record the stream.

the

_canRecord = NDIlib.recv_recording_is_supported(_recvInstancePt r);

alsways returns false.

Also

// frame settings - check for extended functionality
case NDIlib.frame_type_e.frame_type_status_change:
// check for PTZ
IsPtz = NDIlib.recv_ptz_is_supported(_recvInstancePtr);

// Check for recording
IsRecordingSupported = NDIlib.recv_recording_is_supported(_recvInstancePt r);

// Check for a web control URL
// We must free this string ptr if we get one.
IntPtr webUrlPtr = NDIlib.recv_get_web_control(_recvInstancePtr);
if (webUrlPtr == IntPtr.Zero)
{
WebControlUrl = String.Empty;
}
else
{
// convert to managed String
WebControlUrl = NDI.UTF.Utf8ToString(webUrlPtr);

// Don't forget to free the string ptr
NDIlib.recv_free_string(_recvInstancePtr, webUrlPtr);
}

break;


is never run.


but when i installed IsoRecorder i can record the same input without problem?.....

Am i missing any flags/options i need to set to be able to record?...


My main Sender Functions:



// callback function, called when a new screenshot is taken.
private static void Render(object sender, Bitmap image)
{
if (!Directory.Exists(imageFolder))
Directory.CreateDirectory(imageFolder);

// string str = $"{DateTime.Now.Minute.ToString()}{DateTime.Now.Seco nd.ToString()}{DateTime.Now.Millisecond.ToString() }";
//image.Save(Path.Combine(imageFolder, $"{str}.bmp"));

BitmapData data = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);
videoFrame.BufferPtr = data.Scan0;
sendInstance.Send(videoFrame);

image.UnlockBits(data);
}

static void Main()
{
failoverName = String.Format("{0} (NDIlib Send Example)", System.Net.Dns.GetHostName());
sendInstance = new Sender("Example", true, false, null, failoverName);

videoFrame = new VideoFrame(1920, 1080, (16.0f / 9.0f), 1000, 30);

audioFrame = new AudioFrame(1700, 48000, 2);
bmp = new Bitmap(videoFrame.Width, videoFrame.Height, videoFrame.Stride, System.Drawing.Imaging.PixelFormat.Format32bppPArg b, videoFrame.BufferPtr);
ScreenShotThread = new Thread(new ThreadStart(ScreenShot));
ScreenShotThread.Start();
Console.ReadLine();
} // Main

livepad
07-07-2019, 08:55 AM
Hi All!
What i can't seem to figure out and cant find any documentation about is how to record the stream.


The NDI Record function you mention is really asking if the sending device is capable of recording *itself*. For example an NDI PTZ Camera with an on-board SD card recorder.

ISOCorder is actually doing all the work itself to receive the frames in the normal way and then encoding that disk.

Wyvern_010
07-07-2019, 09:52 AM
The NDI Record function you mention is really asking if the sending device is capable of recording *itself*. For example an NDI PTZ Camera with an on-board SD card recorder.

ISOCorder is actually doing all the work itself to receive the frames in the normal way and then encoding that disk.

Thanks for your response!

Guess i will be going deeper into the rabit hole.

Any recomandations to library that do most of the work for me/us? (something with re-inventing the wheel)

Currently experimenting with AForge/Accord