p-rivero / DiscordAudioStream

Windows utility for streaming (with audio!) in Discord. Easily share the the audio of entire screen, or even use OBS for streaming!
GNU General Public License v3.0
180 stars 7 forks source link

Support for Input Video/Sound Streams #47

Closed Statharas closed 6 months ago

Statharas commented 6 months ago

The app is amazing for what it does, but I see room for supporting input streams, such as capture cards and/or cameras.

p-rivero commented 6 months ago

This sounds like an interesting idea, but I can't think of any workflow where that would be useful. Could you elaborate on what you would use this for?

I suppose you are aware that you can capture the OBS projector window, so you could use OBS to capture the camera and then capture its window. The only case where it would be useful to capture the camera directly is if you want your stream to only show your webcam, without cropping or any other video source. If you want to add any effects, or show your webcam + screen, you would need to use OBS anyway (and then capture the OBS projector window).

Statharas commented 6 months ago

The regular workflow is that OBS is used to capture audio and video and stream it. The problem with this starts happening in discord, which this app solves. This creates two windows that show the same video playback.

Were we able to manually add video inputs and audio inputs via this app, we are no longer relying on OBS to utilize the capture card, as this app would be turning the two streams into what is essentially a new app/OBS input and would sit inbetween the two.

This also enables us to view the capture card content directly on the PC, without relying on passthrough. This does provide some room for external plugins to improve the video quality, but let's keep that topic for another time.

p-rivero commented 6 months ago

I agree that this would be useful for video capture cards. I'll have a try at implementing this when I have some free time.

p-rivero commented 6 months ago

Please take a look at the latest pre-release and let me know if it works for you. I don't have a video capture card, so I can't test if it works correctly with those, but it seems to work fine with my webcam.

Statharas commented 6 months ago

Works great! The only issue i've encountered so far is Vsync: image

I'm not sure if it is hardware related (i.e. capture card) or by the capturing method.

Statharas commented 6 months ago

I also got you a stacktrace of an error I'm encountering related to the preview bitmap.

System.ArgumentException: Parameter is not valid. at System.Drawing.Image.get_Width() at System.Drawing.Image.get_Size() at DiscordAudioStream.MainController.RefreshPreviewSize() in C:\Users\Stath\OneDrive\Documents\GitHub\DiscordAudioStream\DiscordAudioStream\MainController.cs:line 142 at DiscordAudioStream.MainController.StartStream(Boolean skipAudioWarning) in C:\Users\Stath\OneDrive\Documents\GitHub\DiscordAudioStream\DiscordAudioStream\MainController.cs:line 183 at DiscordAudioStream.MainForm.startButton_Click(Object sender, EventArgs e) in C:\Users\Stath\OneDrive\Documents\GitHub\DiscordAudioStream\DiscordAudioStream\MainForm.cs:line 375 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I think the UI layer must be separated from the functionality.

p-rivero commented 6 months ago

Regarding the vsync, you could use OBS to determine if the issue is caused by the hardware or the capture method. Create a new source of type "Video capture device" and select your capture card as the Device. Then you can check if the screen tearing is also noticeable in OBS.

Regarding the error you encountered, I have been able to reproduce it, and it will be fixed soon. It's not related to the webcam / capture card functionality, and it can also occur when starting the stream while capturing a window or monitor. Fortunately it's quite rare, so if it happens you can just ignore it and try again.

p-rivero commented 6 months ago

The crash should now be resolved in the pre-release.

p-rivero commented 6 months ago

This functionality is now released in v1.4.2, feel free to reopen if you encounter more crashes.