0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
Commit Graph

36 Commits

Author SHA1 Message Date
Lain
106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
derrod
72759ae69d obs-outputs: Don't set DTS offset for enhanced FLV SEQ start/end packets
Sequence start and end packets never have a valid DTS, but with a
non-zero offset the timestamp in the packet would end up also being
non-zero, which leads to librtmp attempting to calculate a timestamp
delta and underflowing.

As a fix, simply remove the ability to even set a DTS offset for
start/end packets and always keep it at zero.
2023-04-17 17:42:15 -04:00
derrod
64f3070753 obs-outputs: Fix enhanced RTMP frame type not being set 2023-04-17 16:39:13 -04:00
nquah
eca5c51df0 obs-outputs: Fix HEVC/RTMP composition time missing
Fixes bug in Enhanced RTMP implementation. Populates non-zero
HEVC composition times in the FLV extended video tag header.
2023-04-04 23:14:14 +02:00
derrod
678a98ace2 obs-outputs: Fix compilation without ENABLE_HEVC 2023-03-26 20:43:27 -04:00
Yuriy Chumak
2d4f0ac440 obs-outputs: Add support for AV1/HEVC over RTMP
Implements AV1 and HEVC according to enhanced RTMP spec found at
https://github.com/veovera/enhanced-rtmp

Co-authored-by: derrod <dennis@obsproject.com>
2023-03-26 16:37:31 +02:00
Norihiro Kamae
d89ca58467 obs-outputs: Remove unused macro 2023-01-28 19:03:55 -08:00
jpark37
e581802812 obs-outputs: Remove WIN32_LEAN_AND_MEAN define
It should already be defined near the Windows.h include.
2021-10-10 19:12:45 -07:00
Tommy Vercetti
e075ad5bca obs-outputs: Add WIN32_LEAN_AND_MEAN to avoid symbol clash 2021-09-11 15:50:06 -07:00
Shaolin
420823bfaa plugins: Clear compile warnings on Linux 2020-08-26 01:34:03 -03:00
jp9000
d310f1532b obs-outputs: Remove legacy multitrack code 2020-08-24 13:07:55 -07:00
jp9000
189fc7ab6a obs-outputs: Add support for metadata-based multitrack 2020-08-22 08:27:58 -07:00
jp9000
746a522986 obs-outputs: Don't assume @setDataFrame
Don't assume @setDataFrame when using an info packet.  I'm guessing
librtmp did this because the only time this packet type was normally
used was when you use onMetaData.
2020-08-22 08:27:58 -07:00
fengyifan
4ffe5859a1 obs-outputs: Use FLV codec IDs for videocodecid/audiocodecid
Fixes the codec IDs in onMetaData to be compliant with FLV spec.  Using
string representation of these values is non-standard
2020-07-12 14:00:56 -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
pkviet
ce339ce613 obs-outputs/flv: Fix ECMA array size
Fixes the size of the ECMA array storing onMetadata in flv.
(from 14 to 20).
Fixes ticket 1204.
2018-03-23 19:43:48 +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
pkviet
fb580535c9 libobs/media-io: Clean surround API
(also modifies obs-ffmpeg, audio-monitoring, win-wasapi, decklink,
obs-outputs)

Removes speaker layouts which are not exposed in UI.  The speaker
layouts selectable by users in the UI are the most common ones.  It is
not necessary to keep other layouts.  (This basically removes
5POINT1_SURROUND, 7POINT1_SURROUND, SURROUND =3.0).
2018-01-05 09:47:59 -08:00
pkviet
bbac3280c1 libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)

Adds surround sound audio support to the core, core plugins, and user
interface.

Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts  (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
		   opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
	 HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
	 videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
         (due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST:	 stereo plugins keep in general only the first two channels.
	 surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
         (not implemented due to lack of usefulness)

Closes jp9000/obs-studio#968
2017-11-26 03:41:53 -08:00
jp9000
8d424cf1c7 obs-outputs: Fix FLV muxing bug
The end of an FLV tag would contain the size of the tag, but the code
was erroneously including the end size value in addition, which it's not
supposed to do normally.
2017-10-02 07:36:02 -07:00
jp9000
4a5ac39749 libobs: Fix starting video packet offset in outputs
(This commit also modifies the obs-outputs module)

The first video packet video offset (the value used to set the starting
point of video data) would be set to the DTS value of the first video
packet.  However, when b-frames are used, the first DTS value will be
negative.  This was originally done because FLV muxing requires that the
first packet's DTS start from 0.  Unfortunately, this would also
effectively cause the first packet's PTS/DTS value to be shifted forward
by the negative amount, which would cause video sync to be off by a
video frame or two.

This fixes it to start at the PTS value instead and preserve any
negative offsets.  Additionally, the FLV muxing code has been fixed to
ensure that it adjusts the starting video DTS to 0, and now correctly
adjusts the first audio packet's timestamp according to that DTS as well
(which it didn't do before).
2017-10-02 07:36:02 -07:00
Ryan Foster
be98cee2a0 Fix various typos across multiple modules 2017-04-25 22:39:42 -04:00
jp9000
ad3d448f19 obs-ffmpeg: Use actual audio encoder sample rate
Uses the sample rate the audio encoder is running at for ffmpeg muxing
(in case the audio sample rate had to be changed by the encoder)
2015-07-09 10:44:24 -07:00
jp9000
84e1f47ced (API Change) Add support for multiple audio mixers
API changed:
--------------------------

void obs_output_set_audio_encoder(
		obs_output_t *output,
		obs_encoder_t *encoder);

obs_encoder_t *obs_output_get_audio_encoder(
		const obs_output_t *output);

obs_encoder_t *obs_audio_encoder_create(
		const char *id,
		const char *name,
		obs_data_t *settings);

Changed to:
--------------------------

/* 'idx' specifies the track index of the output */
void obs_output_set_audio_encoder(
		obs_output_t *output,
		obs_encoder_t *encoder,
		size_t idx);

/* 'idx' specifies the track index of the output */
obs_encoder_t *obs_output_get_audio_encoder(
		const obs_output_t *output,
		size_t idx);

/* 'mixer_idx' specifies the mixer index to capture audio from */
obs_encoder_t *obs_audio_encoder_create(
		const char *id,
		const char *name,
		obs_data_t *settings,
		size_t mixer_idx);

Overview
--------------------------
This feature allows multiple audio mixers to be used at a time.  This
capability was able to be added with surprisingly very little extra
overhead.  Audio will not be mixed unless it's assigned to a specific
mixer, and mixers will not mix unless they have an active mix
connection.

Mostly this will be useful for being able to separate out specific audio
for recording versus streaming, but will also be useful for certain
streaming services that support multiple audio streams via RTMP.

I didn't want to use a variable amount of mixers due to the desire to
reduce heap allocations, so currently I set the limit to 4 simultaneous
mixers; this number can be increased later if needed, but honestly I
feel like it's just the right number to use.

Sources:

Sources can now specify which audio mixers their audio is mixed to; this
can be a single mixer or multiple mixers at a time.  The
obs_source_set_audio_mixers function sets the audio mixer which an audio
source applies to.  For example, 0xF would mean that the source applies
to all four mixers.

Audio Encoders:

Audio encoders now must specify which specific audio mixer they use when
they encode audio data.

Outputs:

Outputs that use encoders can now support multiple audio tracks at once
if they have the OBS_OUTPUT_MULTI_TRACK capability flag set.  This is
mostly only useful for certain types of RTMP transmissions, though may
be useful for file formats that support multiple audio tracks as well
later on.
2015-02-04 16:51:29 -08:00
jp9000
c9df41c1e2 (API Change) Remove pointers from all typedefs
Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
2014-09-25 21:48:11 -07:00
jp9000
f75a1ebf63 Plugins: Use new encoder/output size functions 2014-08-10 17:10:20 -07:00
jp9000
42a0925ce1 (API Change) media-io: Improve naming consistency
Renamed:                        To:
-----------------------------------------------------------
audio_output_blocksize          audio_output_get_block_size
audio_output_planes             audio_output_get_planes
audio_output_channels           audio_output_get_channels
audio_output_samplerate         audio_output_get_sample_rate
audio_output_getinfo            audio_output_get_info
audio_output_createline         audio_output_create_line
video_output_getinfo            video_output_get_info
video_gettime                   video_output_get_time
video_getframetime              video_output_get_frame_time
video_output_width              video_output_get_width
video_output_height             video_output_get_height
video_output_framerate          video_output_get_frame_rate
video_output_num_skipped_frames video_output_get_skipped_frames
video_output_total_frames       video_output_get_total_frames
2014-08-09 11:57:37 -07:00
jp9000
04712b5fe9 (API Change) Unsquish obs_data_* names
Changed:                 To:
-----------------------------------------------
obs_data_getjson         obs_data_get_json
obs_data_getstring       obs_data_get_string
obs_data_getint          obs_data_get_int
obs_data_getdouble       obs_data_get_double
obs_data_getbool         obs_data_get_bool
obs_data_getobj          obs_data_get_obj
obs_data_getarray        obs_data_get_array
obs_data_setstring       obs_data_set_string
obs_data_setint          obs_data_set_int
obs_data_setdouble       obs_data_set_double
obs_data_setbool         obs_data_set_bool
obs_data_setobj          obs_data_set_obj
obs_data_setarray        obs_data_set_array
obs_data_item_getstring  obs_data_item_get_string
obs_data_item_getint     obs_data_item_get_int
obs_data_item_getdouble  obs_data_item_get_double
obs_data_item_getbool    obs_data_item_get_bool
obs_data_item_getobj     obs_data_item_get_obj
obs_data_item_getarray   obs_data_item_get_array
obs_data_item_setstring  obs_data_item_set_string
obs_data_item_setint     obs_data_item_set_int
obs_data_item_setdouble  obs_data_item_set_double
obs_data_item_setbool    obs_data_item_set_bool
obs_data_item_setobj     obs_data_item_set_obj
obs_data_item_setarray   obs_data_item_set_array
2014-08-09 11:57:36 -07:00
jp9000
4c539a427d Use OBS_CONFIG as version string for the FLV mux 2014-07-14 09:52:36 -07:00
jp9000
5c5f63e8b8 Output version/commit to RTMP stream metadata
Might come in useful for debugging issues later on.
2014-07-01 13:41:32 -07:00
jp9000
1d2e5d50a4 Add FLV file output code
This doesn't add FLV file output to the user interface yet, but we'll
get around to that eventually.  This just adds an FLV output type.

Also, removed ftello/fseeko because off_t is a really annoying data
type, and I'd rather have a firm int64_t for large sizes, so I named it
to os_fseeki64 and os_ftelli64 instead, and changed the file size
function to return an int64_t.
2014-05-16 00:18:23 -07:00
jp9000
a4a52d1c87 Fix bug where packets weren't interleaving
Packets were not interleaving, thus new data was being sent out with
potentially non-monotonically increasing timestamps
2014-04-14 02:02:59 -07:00
jp9000
519c4f4118 Fix issue when using multiple video encoders
- Fix an issue that could occur when using more than one video encoder.
   Audio/video would not sync up correctly because they were expected to
   be paired with a particular encoder.  This simply adds a little
   helper variable to encoder packets that specifies the system time in
   microseconds.  We then use that system time to sync

 - Fix an issue with x264 with fractional FPS rates (29.97 and 59.94
   particularly) where it would create ridiculously large stream
   outputs.  The problem was that you shouldn't set the timebase_*
   variables in the x264 params manually, let x264 handle the default
   values for it and leave them at 0.

 - Make x264 use CFR output, because there's no reason to ever use VFR
   in this case.
2014-04-10 11:59:42 -07:00
jp9000
92522d1886 Implement RTMP module (still needs drop code)
- Implement the RTMP output module.  This time around, we just use a
   simple FLV muxer, then just write to the stream with RTMP_Write.
   Easy and effective.

 - Fix the FLV muxer, the muxer now outputs proper FLV packets.

 - Output API:
   * When using encoders, automatically interleave encoded packets
     before sending it to the output.

   * Pair encoders and have them automatically wait for the other to
     start to ensure sync.

   * Change 'obs_output_signal_start_fail' to 'obs_output_signal_stop'
     because it was a bit confusing, and doing this makes a lot more
     sense for outputs that need to stop suddenly (disconnections/etc).

 - Encoder API:
   * Remove some unnecessary encoder functions from the actual API and
     make them internal.  Most of the encoder functions are handled
     automatically by outputs anyway, so there's no real need to expose
     them and end up inadvertently confusing plugin writers.

   * Have audio encoders wait for the video encoder to get a frame, then
     start at the exact data point that the first video frame starts to
     ensure the most accrate sync of video/audio possible.

   * Add a required 'frame_size' callback for audio encoders that
     returns the expected number of frames desired to encode with.  This
     way, the libobs encoder API can handle the circular buffering
     internally automatically for the encoder modules, so encoder
     writers don't have to do it themselves.

 - Fix a few bugs in the serializer interface.  It was passing the wrong
   variable for the data in a few cases.

 - If a source has video, make obs_source_update defer the actual update
   callback until the tick function is called to prevent threading
   issues.
2014-04-07 22:00:10 -07:00
jp9000
4a652ec82d obs-output module: Fill out more functions
- Add start/stop code to obs-output module

 - Use a circular buffer for the buffered encoder packets instead of a
   dynamic array

 - Add pthreads.lib as a dependency to obs-output module on windows in
   visual studio project files

 - Fix an windows export bug for avc parsing functions on windows.
   Also, rename those functions to be more consistent with each other.

 - Make outputs use a single function for encoded data rather than
   multiple functions

 - Add the ability to make 'text' properties be passworded
2014-04-02 00:42:12 -07:00
jp9000
0cf9e0cfdd Add preliminary FLV/RTMP output (incomplete)
- obs-outputs module:  Add preliminary code to send out data, and add
   an FLV muxer.  This time we don't really need to build the packets
   ourselves, we can just use the FLV muxer and send it directly to
   RTMP_Write and it should automatically parse the entire stream for us
   without us having to do much manual code at all.  We'll see how it
   goes.

 - libobs:  Add AVC NAL packet parsing code

 - libobs/media-io:  Add quick helper functions for audio/video to get
   the width/height/fps/samplerate/etc rather than having to query the
   info structures each time.

 - libobs (obs-output.c):  Change 'connect' signal to 'start' and 'stop'
   signals.  'start' now specifies an error code rather than whether it
   simply failed, that way the client can actually know *why* a failure
   occurred.  Added those error codes to obs-defs.h.

 - libobs:  Add a few functions to duplicate/free encoder packets
2014-04-01 11:55:18 -07:00