Commit Graph

199 Commits (fddbbe259da6091086d457666241a13d3e9c3e23)

Author SHA1 Message Date
jp9000 3691dc536d win-dshow: Fix virtual camera filter name
The filter name is supposed to be "OBS Virtual Camera"
2020-07-20 14:22:49 -07:00
Clayton Groeneveld f4223ad061 win-dshow: Fix virtual camera enable bug 2020-07-20 06:02:16 -05:00
jp9000 6377fe3177 win-dshow: Add Virtual Camera (Windows)
The virtual camera adds the ability to use the output of OBS itself as a
camera that can be selected within other Windows applications.  This is
very loosely based upon the catxfish virtual camera plugin design.

There is a shared memory queue, but instead of having 10-20 frames in
the queue, there are now only 3 frames in the queue to minimize latency
and reduce memory usage.  The third frame is mostly to ensure that
writing does not occur on the same frame being read; the delay is merely
one frame at all times.

The frames of the shared memory queue are NV12 instead of YUYV, which
reduces the memory and data copied, as well as eliminate unnecessary
conversion from NV12.  Some programs (such as chrome, which uses webrtc
to capture) do not support NV12 however, so an I420 conversion is
provided, which is far less expensive than YUYV.  The CPU cost of NV12
-> I420 is negligible in comparison.

The virtual camera filter itself is based upon the output filter within
the libdshowcapture library, which was originally implemented for other
purposes.  This is more ideal than the Microsoft example code because
for one, it's far less convoluted, two, allows us to be able to
customize the filter to our needs a bit more easily, and three, has much
better RAII.  The Microsoft CBaseFilter/etc code comprised of about 30
source files, where as the output filter comprises of two or three
required source files which we already had, so it's a huge win to
compile time.

Scaling is avoided whenever possible to minimize CPU usage.  When the
virtual camera is activated in OBS, the width, height, and frame
interval are saved, that way if the filter is activated, it will always
remember the last OBS resolution/interval that the virtual camera was
activated with, even if OBS is not active.  If for some reason the
filter activates before OBS starts up, and OBS starts up with a
different resolution, it will use simple point scaling intermittently,
and then will remember the new scaling in the future.  The scaler could
use some optimization.  FFmpeg was not opted for because the FFmpeg DLLs
would have to be provided for both architectures, which would be about
30 megabytes in total, and would make writing the plugin much more
painful.  Thus a simple point scaling algorithm is used, and scaling is
avoided whenever possible.

(If another willing participant wants to have a go at improving the
scaling then go for it.  But otherwise, it avoids scaling whenever
possible anyway, so it's not a huge deal)
2020-07-07 06:09:59 -07:00
jp9000 7993179466 cmake: Add cmake folders 2020-05-13 06:52:37 -07:00
Colin Edwards 55e2985026
Merge pull request #1944 from WizardCM/windows-rc-definition
CMake: Build Windows modules with file descriptors
2020-04-18 18:27:22 -05:00
Gol-D-Ace d74fc65047 Update translations from Crowdin 2020-03-16 20:14:50 +01:00
jp9000 40817331d3 win-dshow: Fix rotation not working in all cases 2020-03-07 06:48:07 -08:00
jp9000 07089873fc win-dshow: Add support for devices that relay rotation
Adds support for devices that can relay rotation, such as the Logitech
StreamCam.
2020-03-01 03:42:46 -08:00
jpark37 9eeef48b5a win-dshow: Fix upside-down RGB DIBs
Fix regression to RGB DIB orientation according to MSDN.
2020-01-13 21:50:54 -08:00
jpark37 3f58810b0e libdshowcapture: Update to latest submodule 2019-12-08 14:52:00 -08:00
Jim c36e3fbc92
Merge pull request #2196 from jpark37/ffmpeg-mjpeg-spam
win-dshow: Suppress MJPEG error spam
2019-11-29 20:48:40 -08:00
jpark37 f685322a0f win-dshow: Suppress MJPEG error spam
Only print the first message for this known benign error.
2019-11-24 23:59:27 -08:00
Clayton Groeneveld 82ffcdc827 UI: Add source icons 2019-11-24 20:50:42 -08:00
jpark37 f896c773e8 win-dshow: Support bottom-up DIBs
The biHeight field can be negative, leading to crashes on some cards
like VisionRGB-E1S. Adding flip support is fairly straightforward.

There also appears to be a hack to automatically flip for RGB formats,
but I wish to remove it because it seems to fight with this change. We
already have a separate vertical flip checkbox to deal with non
compliant behavior.
2019-11-12 17:59:59 -08:00
wanhongqing 9b4d9c6788 win-dshow: Fix format switching issue
If the format was one encoded format and changes to another encoded
format, it could cause it to continue to treat it as the old format.
2019-11-12 14:37:32 -08:00
Matt Gajownik 51be039cf8 CMake: Build Windows modules with file descriptors 2019-10-15 21:34:12 +11:00
jp9000 eee40ec6d6 win-dshow: Do not allow H264 to have same priority as MJPEG
This prevents VideoFormat::Any from unintentionally selecting H264 when
MJPEG is the only other format available.

This fixes a bug where certain devices (Logitech C920 with latest
drivers) will only have H264 and MJPEG available, and using
VideoFormat::Any will then select H264 over MJPEG because it's the first
format value and has the same priority as MJPEG.  So now, MJPEG will be
prioritized over H264 instead.
2019-09-19 00:12:07 -07:00
jp9000 6f1cb5a8f8 win-dshow: Disable HW decode in DirectShow for now
This did not get enough testing, so disable it for now until more
devices can be tested (especially the live gamer portable).
2019-09-18 18:14:22 -07:00
Gol-D-Ace 03b5be75e4 Update translations from Crowdin 2019-09-17 23:21:00 +02:00
jpark37 f60b820fee win-dshow: Fix color range when using FFmpeg decode
Full color range seems to be active when decoding video with FFMmpeg
even when partial is explicitly selected. This should keep the range
synchronized.
2019-09-14 17:12:29 -07:00
jp9000 deaeb5e632 win-dshow: Use unbuffered by default for MJPEG
Due to the recent change of using FFmpeg to decode MJPEG, MJPEG was
getting included in the delayed device check.  This fixes that so that
it doesn't.  MJPEG can decode in real time.
2019-07-29 20:34:13 -07:00
jp9000 cd6e9e34b8 win-dshow: Clarify function name/purpose
IsEncoded is meant to be used to indicated delayed devices, such as
older Elgato devices, or Hauppauge device.  Devices that use H264 and
have a 800+ millisecond latency.  This changes the function name to
better indicate that.
2019-07-29 20:34:13 -07:00
jp9000 68a5a40df9 libobs, obs-ffmpeg, win-dshow: Fix FFmpeg 4.0 deprecation
Fixes FFmpeg 4.0 deprecation warnings.
2019-07-29 20:34:13 -07:00
jp9000 a3fface27f win-dshow, obs-ffmpeg: Add hardware decoding support
Fixes hardware decoding support and updates it to FFmpeg 4.0.
2019-07-29 20:34:13 -07:00
James Park 0e7eec8f2d win-dshow: Use FFmpeg for MJPEG decompression
Measured lower CPU usage and latency than default DirectShow filter.
Tested with Logitech BRIO camera at 4K, 30 FPS.
2019-07-25 20:11:44 -07:00
James Park 37f663a789 libobs: obs-ffmpeg: win-dshow: Planar 4:2:2 video
This format has been seen when using FFmpeg MJPEG decompression.
2019-07-25 20:11:37 -07:00
jp9000 cdb7cd80f6 win-dshow: Update libdshowcapture to 0.6.1 2019-07-20 20:24:52 -07:00
Jim ffcfe4c9d9
Merge pull request #1951 from jpark37/audio-buffering
Fix audio buffering for devices like GV-USB2
2019-07-20 17:05:27 -07:00
jpark37 1fc0a357d2 win-dshow: Add "Default" color range setting
VIDEO_RANGE_DEFAULT uses partial range for YUV and full range for RGB.
Previous default was always partial.
2019-07-10 23:40:53 -07:00
James Park 534c553b23 win-dshow: Decouple audio from video
If a device produces video and audio timestamps atdifferent rates,
this divergence can cause massive buffering on the audio side, leading
to a capped audio buffer, and total sound loss. This change allows a
hardcoded list of devices to use the existing decoupling logic. For
now, only "GV-USB2" has been added.

When combined with another fix, 5+ hours of stable audio without any
buffering on my GV-USB2 where it used to drop sound completely after
an hour or so.

Partially fixes https://obsproject.com/mantis/view.php?id=1269
2019-07-05 09:12:57 -07:00
jp9000 f53df7da64 clang-format: Apply formatting
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
2019-06-23 23:49:10 -07:00
Gol-D-Ace 973bc481ce Update translations from Crowdin 2019-06-11 01:42:42 +02:00
sorayuki f67e63b1c6
win-dshow: fix issue decoding some H.264 stream
Logitech C920 web camera will output YUVJ420P which is not supported yet.
2019-05-05 16:18:16 +08:00
James Park a86710ec5b libobs: Support limited color range for RGB/Y800 sources
libobs: Add support for limited to full color range conversions when
using RGB or Y800 formats, and move RGB converison for Y800 formats to
the GPU.

decklink: Stop hiding color space/range properties for RGB formats, and
remove "YUV" from "YUV Color Space" and "YUV Color Range".

win-dshow: Remove "YUV" from "YUV Color Space" and "YUV Color Range".

UI: Remove "YUV" from "YUV Color Space" and "YUV Color Range".
2019-04-25 15:13:05 -07:00
jp9000 7d136c3ce1 decklink, win-dshow: Use obs_source_output_video2
Allows the ability to override and use partial range RGB with the
DirectShow and Decklink device sources when partial range RGB is
implemented.  Fixes certain cases where devices could capture RGB in
limited range via HDMI (per the HDMI specs).
2019-04-25 15:12:33 -07:00
Gol-D-Ace 9fc1069e9b Remove double spaces from localization 2019-04-08 16:02:32 +02:00
Gol-D-Ace e78ac5ebef Update translations from Crowdin 2019-04-04 16:19:51 +02:00
Richard Stanway 0bf09160e5 win-dshow: Update libdshowcapture for crash fix 2019-03-25 17:16:21 +01:00
James Park b3c2e74d0f win-dshow: Fix "Highest FPS" algorithm
MatcherClosestFrameRateSelector updates best_match as a side effect of
visiting every VideoInfo instance, but CapsMatch uses std::any_of,
which will stop iterating prematurely on first match. This means that
the highest FPS is not selected.

This change switches to a for loop that doesn't exit early.
2019-03-03 10:05:09 -08:00
Gol-D-Ace c3711bdd5e Update translations from Crowdin 2019-02-20 22:26:07 +01:00
Jim af320a0838
Merge pull request #1480 from kkartaltepe/module-descriptions
Plugins: Add descriptions to modules
2018-09-16 15:34:28 -07:00
Kurt Kartaltepe d86c8121ed Plugins: Add descriptions to modules 2018-09-11 18:28:58 -07:00
Gol-D-Ace a79aaa28ab Update translations from Crowdin 2018-08-18 04:16:35 +02:00
Ilya Melamed db06a1c12a win-dshow: Allow synchronous create/update
Allows the ability to (optionally) synchronously create/update a
directshow device source rather than always asynchronously update the
device.  This is useful if creating/destroying scenes/sources very
quickly, and helps minimize the risk of creating new directshow sources
that use the same device, yet may not activate because an existing
source may already exist.  To use, set "synchronous_activate" to true in
its settings when updating or creating.  Note that this setting will be
erased after it's used, and will not be saved to user settings, so it
must be set each time in order to be used.

Closes obsproject/obs-studio#1228
2018-05-05 11:44:14 -07:00
Gol-D-Ace 88282c168c Update translations from Crowdin 2018-03-15 09:00:28 +01:00
jp9000 bd30a0874d win-dshow: Fix decoding issues from encoded devices 2018-01-22 14:41:00 -08:00
Gol-D-Ace ae22886f67 Update translations from Crowdin 2018-01-22 04:55:52 +01:00
pkviet 67e48ecc2c libobs/media-io: Replace quad with 4.0
(also obs, deps/media-playback, libobs/audio-monitoring, decklink,
linux-alsa, linux-pulseaudio, mac-capture, obs-ffmpeg, win-dshow,
win-wasapi)

Default channel layout for 4 channels is 4.0 in FFmpeg.
Replacing quad with 4.0 will improve compatibility since FFmpeg has
better support of its default channel layouts.
2018-01-05 09:48:52 -08:00
jp9000 0d6204c8af Fix a number of MSVC warnings
Fixes a number of warnings with all modules
2017-12-05 13:53:44 -08:00
Thomas Schnitzler 09e79aba08 win-dshow: Improve automatic Elgato audio device selection
Implement automatic audio device selection for devices that use two
separate DirectShow filters for audio and video instead of having a
single filter with audio and video output pins.

Please note that this fix is currently only active for Elgato USB and
PCIe devices (e.g. Cam Link, HD60 S, HD60 Pro, 4K60 Pro) to avoid
unintentionally changing the behavior for any other devices (e.g.
webcams).

(Jim edit: This fixes an issue with newer Elgato devices where the
devices would not automatically have their audio coupled with the video;
users would have to manually select the audio device in order to get
audio functioning.)

Closes jp9000/obs-studio#1081
2017-11-29 04:04:53 -08:00