Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
42be9687
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
42be9687
编写于
4月 04, 2014
作者:
P
Palana
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make OBS basic and obs-ffmpeg-output use NV12 by default
上级
4edadcc0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
9 deletion
+17
-9
obs/window-basic-main.cpp
obs/window-basic-main.cpp
+2
-1
plugins/obs-ffmpeg/obs-ffmpeg-output.c
plugins/obs-ffmpeg/obs-ffmpeg-output.c
+15
-8
未找到文件。
obs/window-basic-main.cpp
浏览文件 @
42be9687
...
...
@@ -417,7 +417,8 @@ bool OBSBasic::ResetVideo()
"Video"
,
"OutputCX"
);
ovi
.
output_height
=
(
uint32_t
)
config_get_uint
(
basicConfig
,
"Video"
,
"OutputCY"
);
ovi
.
output_format
=
VIDEO_FORMAT_I420
;
//ovi.output_format = VIDEO_FORMAT_I420;
ovi
.
output_format
=
VIDEO_FORMAT_NV12
;
ovi
.
adapter
=
0
;
ovi
.
gpu_conversion
=
true
;
...
...
plugins/obs-ffmpeg/obs-ffmpeg-output.c
浏览文件 @
42be9687
...
...
@@ -26,6 +26,9 @@
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
//#define OBS_FFMPEG_VIDEO_FORMAT VIDEO_FORMAT_I420
#define OBS_FFMPEG_VIDEO_FORMAT VIDEO_FORMAT_NV12
/* NOTE: much of this stuff is test stuff that was more or less copied from
* the muxing.c ffmpeg example */
...
...
@@ -177,8 +180,9 @@ static bool open_video_codec(struct ffmpeg_data *data)
static
bool
init_swscale
(
struct
ffmpeg_data
*
data
,
AVCodecContext
*
context
)
{
enum
AVPixelFormat
format
=
obs_to_ffmpeg_video_format
(
OBS_FFMPEG_VIDEO_FORMAT
);
data
->
swscale
=
sws_getContext
(
context
->
width
,
context
->
height
,
AV_PIX_FMT_YUV420P
,
context
->
width
,
context
->
height
,
format
,
context
->
width
,
context
->
height
,
context
->
pix_fmt
,
SWS_BICUBIC
,
NULL
,
NULL
,
NULL
);
...
...
@@ -214,7 +218,7 @@ static bool create_video_stream(struct ffmpeg_data *data)
context
->
time_base
.
num
=
ovi
.
fps_den
;
context
->
time_base
.
den
=
ovi
.
fps_num
;
context
->
gop_size
=
120
;
context
->
pix_fmt
=
AV_PIX_FMT_YUV420P
;
context
->
pix_fmt
=
obs_to_ffmpeg_video_format
(
OBS_FFMPEG_VIDEO_FORMAT
)
;
if
(
data
->
output
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
context
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
...
...
@@ -222,7 +226,8 @@ static bool create_video_stream(struct ffmpeg_data *data)
if
(
!
open_video_codec
(
data
))
return
false
;
if
(
context
->
pix_fmt
!=
AV_PIX_FMT_YUV420P
)
enum
AVPixelFormat
format
=
obs_to_ffmpeg_video_format
(
OBS_FFMPEG_VIDEO_FORMAT
);
if
(
context
->
pix_fmt
!=
format
)
if
(
!
init_swscale
(
data
,
context
))
return
false
;
...
...
@@ -487,12 +492,13 @@ static inline int64_t rescale_ts(int64_t val, AVCodecContext *context,
AV_ROUND_NEAR_INF
|
AV_ROUND_PASS_MINMAX
);
}
#define YUV420_PLANES 3
static
inline
void
copy_data
(
AVPicture
*
pic
,
const
struct
video_data
*
frame
,
int
height
)
{
for
(
int
plane
=
0
;
plane
<
YUV420_PLANES
;
plane
++
)
{
for
(
int
plane
=
0
;
plane
<
MAX_AV_PLANES
;
plane
++
)
{
if
(
!
frame
->
data
[
plane
])
continue
;
int
frame_rowsize
=
(
int
)
frame
->
linesize
[
plane
];
int
pic_rowsize
=
pic
->
linesize
[
plane
];
int
bytes
=
frame_rowsize
<
pic_rowsize
?
...
...
@@ -523,7 +529,8 @@ static void receive_video(void *param, struct video_data *frame)
if
(
!
data
->
start_timestamp
)
data
->
start_timestamp
=
frame
->
timestamp
;
if
(
context
->
pix_fmt
!=
AV_PIX_FMT_YUV420P
)
enum
AVPixelFormat
format
=
obs_to_ffmpeg_video_format
(
OBS_FFMPEG_VIDEO_FORMAT
);
if
(
context
->
pix_fmt
!=
format
)
sws_scale
(
data
->
swscale
,
(
const
uint8_t
*
const
*
)
frame
->
data
,
(
const
int
*
)
frame
->
linesize
,
0
,
context
->
height
,
data
->
dst_picture
.
data
,
...
...
@@ -761,7 +768,7 @@ static bool try_connect(struct ffmpeg_output *output)
};
struct
video_scale_info
vsi
=
{
.
format
=
VIDEO_FORMAT_I420
.
format
=
OBS_FFMPEG_VIDEO_FORMAT
};
output
->
active
=
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录