mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-24 12:03:14 +08:00
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.
This commit is contained in:
@@ -21,10 +21,11 @@
|
||||
#include "obs-output-ver.h"
|
||||
#include "rtmp-helpers.h"
|
||||
|
||||
/* FIXME: this is currently hard-coded to h264 and aac! ..not that we'll
|
||||
/* TODO: FIXME: this is currently hard-coded to h264 and aac! ..not that we'll
|
||||
* use anything else for a long time. */
|
||||
|
||||
// #define DEBUG_TIMESTAMPS
|
||||
//#define DEBUG_TIMESTAMPS
|
||||
//#define WRITE_FLV_HEADER
|
||||
|
||||
#define VIDEO_HEADER_SIZE 5
|
||||
#define MILLISECOND_DEN 1000
|
||||
@@ -94,11 +95,13 @@ void flv_meta_data(obs_output_t context, uint8_t **output, size_t *size)
|
||||
|
||||
build_flv_meta_data(context, &meta_data, &meta_data_size);
|
||||
|
||||
/* s_write(&s, "FLV", 3);
|
||||
#ifdef WRITE_FLV_HEADER
|
||||
s_write(&s, "FLV", 3);
|
||||
s_w8(&s, 1);
|
||||
s_w8(&s, 5);
|
||||
s_wb32(&s, 9);
|
||||
s_wb32(&s, 0); */
|
||||
s_wb32(&s, 0);
|
||||
#endif
|
||||
|
||||
start_pos = serializer_get_pos(&s);
|
||||
|
||||
|
||||
@@ -226,6 +226,7 @@ static void update_params(struct obs_x264 *obsx264, obs_data_t settings,
|
||||
obsx264->params.i_keyint_max =
|
||||
keyint_sec * voi->fps_num / voi->fps_den;
|
||||
|
||||
obsx264->params.b_vfr_input = false;
|
||||
obsx264->params.rc.i_vbv_max_bitrate = bitrate;
|
||||
obsx264->params.rc.i_vbv_buffer_size = buffer_size;
|
||||
obsx264->params.rc.i_bitrate = bitrate;
|
||||
@@ -233,8 +234,6 @@ static void update_params(struct obs_x264 *obsx264, obs_data_t settings,
|
||||
obsx264->params.i_height = voi->height;
|
||||
obsx264->params.i_fps_num = voi->fps_num;
|
||||
obsx264->params.i_fps_den = voi->fps_den;
|
||||
obsx264->params.i_timebase_num = voi->fps_den;
|
||||
obsx264->params.i_timebase_den = voi->fps_num;
|
||||
obsx264->params.pf_log = log_x264;
|
||||
obsx264->params.i_log_level = X264_LOG_WARNING;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user