Commit graph

17 commits

Author SHA1 Message Date
tytan652 5e4ed49a2d obs-outputs,obs-ffmpeg: Use connect infos in outputs 2023-03-19 17:38:02 +01:00
pkv fcb6df1f63 obs-ffmpeg: Direct setting of encryption & auth for SRT & RIST
Also modifies UI.

This allows the direct use of passphrase (SRT & RIST) used for
encryption, user + password (RIST) as well as streamid (SRT).
Previously, these parameters had to be set in the URL in the form:
URL?option1=value1&option2=value2.
They still can but there is also the option to set them in the stream
key and username/password fields.
SRT:
- the stream_id is set in the stream key (more info on it: [1]);
- the encryption passphrase is set in the password auth field.
RIST:
- the encryption passphrase is set in the stream key;
- the srp_username and srp_password are set in the user/password auth
fields [2].

Additionally, some error logging has been added when there's a
disconnect caused by a wrong password.
Lastly, this solves a bug when auto-reconnect is set and a wrong
passphrase is provided for srt; the output would keep trying to
reconnect. With this commit, an OBS_OUTPUT_INVALID_STREAM signal is
emitted and the stream is immediately stopped.

[1] https://github.com/Haivision/srt/blob/master/docs/features/access-control.md
[2] https://code.videolan.org/rist/librist/-/wikis/Authentication-and-the-ristsrppasswd-Utility

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-17 21:56:38 -05:00
pkv 039d7347a3
obs-ffmpeg: Allow use of old mpegts output
By default, new mpegts output is used; but to allow CI on linux not
to be broken, we allow use of old mpegts output.
Up to ubuntu 22.04 there is no librist package available.
A manual compile is then required but the CI scripts would need to be
updated.
This also allows easy fallback in case of fatal bugs in new output.

Signed-off-by: pkv <pkv@obsproject.com>
2022-07-30 17:03:20 +02:00
pkv e7d097cab8
obs-ffmpeg: Native SRT/RIST for mpegts output
Currently the ffmpeg_mpegts_muxer output is integrated with ffmpeg-mux.
Both use obs native encoders in contrast with obs-ffmpeg-output which
relies on avcodec library.
This allowed easy implementation of SRT, RIST & HLS protocols through
avformat library.
The main drawback is that obs-ffmpeg-mux exe doesn't allow for easy
debugging nor logging of the protocols.
It was written initially as a separate binary designed for recording so
that if obs fails for some reason, the recording can still terminate
gracefully.

In this commit the ffmpeg_mpegts_muxer is rewritten so that a pipe to
the ffmpeg-mux binary is not used any more.
The muxing to mpegts is still delegated to avformat.
But it can be traced more easily in all its steps.
Also the protocol part for SRT & RIST is implemented natively.
Custom avio_contexts for SRT & RIST are used to that end.
This allows to pass our own implementation of librist and libsrt
libraries instead of relying on avformat. This is very advantageous :
- this allows better logging.
- this allows better bug fixing and maintainance without having to rely
on hypothetical upstream fixes.

One immediate bonus of native implementation is that fixes bugs which
were not previously fixable.

Fixes: SRT & RIST auto-reconnect partly broken  #6749
Fixes: SRT: OBS unusable and uncloseable after starting stream to
invalid srt server #5791

Signed-off-by: pkv <pkv@obsproject.com>
2022-07-30 17:03:10 +02:00
tytan652 17ba8359e4 deps,libobs,plugins: Fix discarded-qualifiers warnings with FFmpeg 5 2022-07-22 08:50:36 -04:00
jpark37 0d72c314d4 obs-ffmpeg: Add max luminance metadata for PQ
Necessary for video player to remap display ranges.
2022-04-16 16:26:01 -07:00
Ryan Foster 08547a1696 obs-ffmpeg: Include avcodec header for AVCodecContext
FFmpeg commit e67e02d15672 [1] drops avcodec.h from avformat.h includes.
Therefore we need to include it explicitly.

[1]: e67e02d156
     lavf/avformat.h: drop the avcodec.h include
2021-11-21 11:30:02 -05:00
Jim bfdf5dc947
Merge pull request #2356 from jpark37/sycc-color-space
Color space refinements
2020-08-05 08:58:21 -07:00
jpark37 ffbc3ed923 obs-ffmpeg: Fix race and deprecation warnings
Attempt to simply shutdown sequence to avoid race between vidoe and
write threads. Can no longer join on write thread from write thread.

Also use codecpar instead of deprecated codec member.
2020-07-19 12:49:53 -07:00
jpark37 37f01b35f6 obs-ffmpeg: Improve color space handling
Add support for VIDEO_CS_SRGB.

Use SMPTE 170M for 601 instead of undef/BT470BG. This is the
American/Chromium way of handling 601.

Add color metadata to the container file as well via ffmpeg-mux.
2020-07-18 19:44:13 -07:00
Aaron Boxer e13dae8299 obs-ffmpeg: Expose ffmpeg_data_init and ffmpeg_data_free methods 2019-11-27 14:40:52 -05:00
jp9000 8e81d8be56 Revamp API and start using doxygen
The API used to be designed in such a way to where it would expect
exports for each individual source/output/encoder/etc.  You would export
functions for each and it would automatically load those functions based
on a specific naming scheme from the module.

The idea behind this was that I wanted to limit the usage of structures
in the API so only functions could be used.  It was an interesting idea
in theory, but this idea turned out to be flawed in a number of ways:

 1.) Requiring exports to create sources/outputs/encoders/etc meant that
     you could not create them by any other means, which meant that
     things like faruton's .net plugin would become difficult.

 2.) Export function declarations could not be checked, therefore if you
     created a function with the wrong parameters and parameter types,
     the compiler wouldn't know how to check for that.

 3.) Required overly complex load functions in libobs just to handle it.
     It makes much more sense to just have a load function that you call
     manually.  Complexity is the bane of all good programs.

 4.) It required that you have functions of specific names, which looked
     and felt somewhat unsightly.

So, to fix these issues, I replaced it with a more commonly used API
scheme, seen commonly in places like kernels and typical C libraries
with abstraction.  You simply create a structure that contains the
callback definitions, and you pass it to a function to register that
definition (such as obs_register_source), which you call in the
obs_module_load of the module.

It will also automatically check the structure size and ensure that it
only loads the required values if the structure happened to add new
values in an API change.

The "main" source file for each module must include obs-module.h, and
must use OBS_DECLARE_MODULE() within that source file.

Also, started writing some doxygen documentation in to the main library
headers.  Will add more detailed documentation as I go.
2014-02-12 08:04:50 -07:00
jp9000 1b8bd57dac Do test recording to a specified file
It will now output to a a filename that you specify when you click the
record button.  This is just for testing.
2014-02-10 10:22:35 -07:00
jp9000 6c92cf5841 Implement output, improve video/audio subsystems
- Fill in the rest of the FFmpeg test output code for testing so it
   actually properly outputs data.

 - Improve the main video subsystem to be a bit more optimal and
   automatically output I420 or NV12 if needed.

 - Fix audio subsystem insertation and byte calculation.  Now it will
   seamlessly insert new audio data in to the audio stream based upon
   its timestamp value.  (Be extremely cautious when using floating
   point calculations for important things like this, and always round
   your values and check your values)

 - Use 32 byte alignment in case of future optimizations and export a
   function to get the current alignment.

 - Make os_sleepto_ns return true if slept, false if the time has
   already been passed before the call.

 - Fix sinewave output so that it actually properly calculates a middle
   C sinewave.

 - Change the use of row_bytes to linesize (also makes it a bit more
   consistent with FFmpeg's naming as well)
2014-02-09 05:51:06 -07:00
jp9000 3d6d43225f Add planar audio support, improve test output
- Add planar audio support.  FFmpeg and libav use planar audio for many
  encoders, so it was somewhat necessary to add support in libobs
  itself.

- Improve/adjust FFmpeg test output plugin.  The exports were somewhat
  messed up (making me rethink how exports should be done).  Not yet
  functional; it handles video properly, but it still does not handle
  audio properly.

- Improve planar video code.  The planar video code was not properly
  accounting for row sizes for each plane.  Specifying row sizes for
  each plane has now been added.  This will also make it more compatible
  with FFmpeg/libav.

- Fixed a bug where callbacks wouldn't create properly in audio-io and
  video-io code.

- Implement 'blogva' function to allow for va_list usage with libobs
  logging.
2014-02-07 03:03:54 -07:00
jp9000 6c44291693 Implement settings interface for plugins
Add a fairly easy to use settings interface that can be passed to
plugins, and replaced the old character string system that was being
used before.  The new data interface allows for an easier method of
getting/altering settings for plugins, and is built to be serializable
to/from JSON.

Also, removed another wxFormBuilder file that was no longer in use.
2014-01-27 23:14:58 -07:00
jp9000 fc8851e9f4 Add preliminary ffmpeg plugin (still testing)
- Added some code for FFmpeg output that I'm still playing around with.
  Right now I'm just trying to get it to output to file and try to
  understand the FFmpeg/libav APIs.  Hopefully in the future this plugin
  can be used for any sort of output to FFmpeg.

- Fixed a cast warning in audio-io.c with size_t -> uint32_t

- Renamed the 'video_info' and 'audio_info' structures to
  'video_conver_info' and 'audio_convert_info' to better represent their
  actual purpose, and to avoid confusion with 'audio_output_info' and
  'video_output_info' structures.

- Removed a few macros from obs-def.h that were at one point going to be
  used but no longer going to be used (at least for now)
2014-01-19 03:16:41 -07:00