mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-05 02:58:04 +00:00
[record] define quality profiles
This commit is contained in:
parent
badac565da
commit
c427847944
@ -54,6 +54,10 @@
|
||||
|
||||
#include "../list_special.h"
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
#include "record/record_driver.h"
|
||||
#endif
|
||||
|
||||
static const char* invalid_filename_chars[] = {
|
||||
/* https://support.microsoft.com/en-us/help/905231/information-about-the-characters-that-you-cannot-use-in-site-names--fo */
|
||||
"~", "#", "%", "&", "*", "{", "}", "\\", ":", "[", "]", "?", "/", "|", "\'", "\"",
|
||||
@ -1593,7 +1597,6 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("aspect_ratio_index", &settings->uints.video_aspect_ratio_idx, true, aspect_ratio_idx, false);
|
||||
#ifdef HAVE_NETWORKING
|
||||
SETTING_UINT("netplay_ip_port", &settings->uints.netplay_port, true, RARCH_DEFAULT_PORT, false);
|
||||
SETTING_UINT("video_stream_port", &settings->uints.video_stream_port, true, RARCH_STREAM_DEFAULT_PORT, false);
|
||||
SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT);
|
||||
SETTING_UINT("netplay_input_latency_frames_min",&settings->uints.netplay_input_latency_frames_min, true, 0, false);
|
||||
SETTING_UINT("netplay_input_latency_frames_range",&settings->uints.netplay_input_latency_frames_range, true, 0, false);
|
||||
@ -1614,6 +1617,12 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
|
||||
SETTING_UINT("midi_volume", &settings->uints.midi_volume, true, midi_volume, false);
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
SETTING_UINT("video_stream_port", &settings->uints.video_stream_port, true, RARCH_STREAM_DEFAULT_PORT, false);
|
||||
SETTING_UINT("video_record_quality", &settings->uints.video_record_quality, true, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, false);
|
||||
SETTING_UINT("video_stream_quality", &settings->uints.video_record_quality, true, RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, false);
|
||||
#endif
|
||||
|
||||
*size = count;
|
||||
|
||||
return tmp;
|
||||
|
@ -388,6 +388,8 @@ typedef struct settings
|
||||
unsigned video_msg_bgcolor_green;
|
||||
unsigned video_msg_bgcolor_blue;
|
||||
unsigned video_stream_port;
|
||||
unsigned video_record_quality;
|
||||
unsigned video_stream_quality;
|
||||
|
||||
unsigned menu_thumbnails;
|
||||
unsigned menu_left_thumbnails;
|
||||
|
@ -5952,22 +5952,6 @@ static bool setting_append_list(
|
||||
general_read_handler);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
recording_driver_get_use_output_dir_ptr(),
|
||||
MENU_ENUM_LABEL_RECORD_USE_OUTPUT_DIRECTORY,
|
||||
MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY,
|
||||
false,
|
||||
MENU_ENUM_LABEL_VALUE_OFF,
|
||||
MENU_ENUM_LABEL_VALUE_ON,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler,
|
||||
SD_FLAG_NONE
|
||||
);
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
|
||||
START_SUB_GROUP(list, list_info, "Miscellaneous", &group_info, &subgroup_info, parent_group);
|
||||
|
@ -89,6 +89,10 @@ extern "C" {
|
||||
#define PIX_FMT_YUV444P AV_PIX_FMT_YUV444P
|
||||
#endif
|
||||
|
||||
#ifndef PIX_FMT_YUV420P
|
||||
#define PIX_FMT_YUV420P AV_PIX_FMT_YUV420P
|
||||
#endif
|
||||
|
||||
#ifndef PIX_FMT_BGR24
|
||||
#define PIX_FMT_BGR24 AV_PIX_FMT_BGR24
|
||||
#endif
|
||||
@ -544,29 +548,112 @@ static bool ffmpeg_init_video(ffmpeg_t *handle)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ffmpeg_init_config_common(struct ff_config_param *params)
|
||||
static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned preset)
|
||||
{
|
||||
params->scale_factor = 1;
|
||||
params->threads = 1;
|
||||
params->frame_drop_ratio = 1;
|
||||
params->audio_enable = true;
|
||||
params->audio_global_quality = 75;
|
||||
params->out_pix_fmt = PIX_FMT_YUV444P;
|
||||
char buf[256];
|
||||
|
||||
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
|
||||
strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec));
|
||||
strlcpy(params->format, "flv", sizeof(params->format));
|
||||
switch (preset)
|
||||
{
|
||||
case RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY:
|
||||
case RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY:
|
||||
params->scale_factor = 1;
|
||||
params->threads = 1;
|
||||
params->frame_drop_ratio = 1;
|
||||
params->audio_enable = true;
|
||||
params->audio_global_quality = 75;
|
||||
params->out_pix_fmt = PIX_FMT_YUV420P;
|
||||
|
||||
av_dict_set(¶ms->video_opts, "video_preset", "ultrafast", 0);
|
||||
av_dict_set(¶ms->video_opts, "video_tune", "ultrafast", 0);
|
||||
av_dict_set(¶ms->video_opts, "video_crf", "18", 0);
|
||||
av_dict_set(¶ms->audio_opts, "audio_global_quality", "75", 0);
|
||||
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
|
||||
strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec));
|
||||
|
||||
av_dict_set(¶ms->video_opts, "preset", "ultrafast", 0);
|
||||
av_dict_set(¶ms->video_opts, "tune", "animation", 0);
|
||||
av_dict_set(¶ms->video_opts, "crf", "30", 0);
|
||||
av_dict_set(¶ms->audio_opts, "audio_global_quality", "75", 0);
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY:
|
||||
case RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY:
|
||||
params->scale_factor = 1;
|
||||
params->threads = 1;
|
||||
params->frame_drop_ratio = 1;
|
||||
params->audio_enable = true;
|
||||
params->audio_global_quality = 75;
|
||||
params->out_pix_fmt = PIX_FMT_YUV420P;
|
||||
|
||||
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
|
||||
strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec));
|
||||
|
||||
av_dict_set(¶ms->video_opts, "preset", "superfast", 0);
|
||||
av_dict_set(¶ms->video_opts, "tune", "animation", 0);
|
||||
av_dict_set(¶ms->video_opts, "crf", "25", 0);
|
||||
av_dict_set(¶ms->audio_opts, "audio_global_quality", "75", 0);
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY:
|
||||
case RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY:
|
||||
params->scale_factor = 1;
|
||||
params->threads = 1;
|
||||
params->frame_drop_ratio = 1;
|
||||
params->audio_enable = true;
|
||||
params->audio_global_quality = 100;
|
||||
params->out_pix_fmt = PIX_FMT_YUV444P;
|
||||
|
||||
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
|
||||
strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec));
|
||||
|
||||
av_dict_set(¶ms->video_opts, "preset", "medium", 0);
|
||||
av_dict_set(¶ms->video_opts, "tune", "animation", 0);
|
||||
av_dict_set(¶ms->video_opts, "crf", "15", 0);
|
||||
av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0);
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY:
|
||||
params->scale_factor = 1;
|
||||
params->threads = 1;
|
||||
params->frame_drop_ratio = 1;
|
||||
params->audio_enable = true;
|
||||
params->audio_global_quality = 100;
|
||||
params->out_pix_fmt = PIX_FMT_BGR24;
|
||||
|
||||
strlcpy(params->vcodec, "libx264rgb", sizeof(params->vcodec));
|
||||
strlcpy(params->acodec, "flac", sizeof(params->acodec));
|
||||
|
||||
av_dict_set(¶ms->video_opts, "preset", "medium", 0);
|
||||
av_dict_set(¶ms->video_opts, "tune", "animation", 0);
|
||||
av_dict_set(¶ms->video_opts, "crf", "0", 0);
|
||||
av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0);
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_STREAMING_NETPLAY:
|
||||
params->scale_factor = 1;
|
||||
params->threads = 1;
|
||||
params->frame_drop_ratio = 1;
|
||||
params->audio_enable = true;
|
||||
params->audio_global_quality = 50;
|
||||
params->out_pix_fmt = PIX_FMT_YUV420P;
|
||||
|
||||
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
|
||||
strlcpy(params->acodec, "mp3", sizeof(params->acodec));
|
||||
|
||||
av_dict_set(¶ms->video_opts, "preset", "ultrafast", 0);
|
||||
av_dict_set(¶ms->video_opts, "tune", "zerolatency", 0);
|
||||
av_dict_set(¶ms->video_opts, "crf", "20", 0);
|
||||
av_dict_set(¶ms->audio_opts, "audio_global_quality", "50", 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (preset <= RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY)
|
||||
strlcpy(params->format, "matroska", sizeof(params->format));
|
||||
else if (preset <= RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY)
|
||||
strlcpy(params->format, "flv", sizeof(params->format));
|
||||
else
|
||||
strlcpy(params->format, "flv", sizeof(params->format));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ffmpeg_init_config_recording(struct ff_config_param *params)
|
||||
{
|
||||
return true;
|
||||
params->threads = 0;
|
||||
params->audio_global_quality = 100;
|
||||
|
||||
@ -703,7 +790,7 @@ static bool ffmpeg_init_muxer_post(ffmpeg_t *handle)
|
||||
}
|
||||
|
||||
av_dict_set(&handle->muxer.ctx->metadata, "title",
|
||||
"RetroArch video dump", 0);
|
||||
"RetroArch Video Dump", 0);
|
||||
|
||||
return avformat_write_header(handle->muxer.ctx, NULL) >= 0;
|
||||
}
|
||||
@ -843,39 +930,7 @@ static void *ffmpeg_new(const struct record_params *params)
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch (params->config_type)
|
||||
{
|
||||
case RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY:
|
||||
ffmpeg_init_config_common(&handle->config);
|
||||
ffmpeg_init_config_recording(&handle->config);
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY:
|
||||
ffmpeg_init_config_common(&handle->config);
|
||||
ffmpeg_init_config_recording(&handle->config);
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY:
|
||||
ffmpeg_init_config_common(&handle->config);
|
||||
ffmpeg_init_config_recording(&handle->config);
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_STREAM_YOUTUBE:
|
||||
ffmpeg_init_config_common(&handle->config);
|
||||
/* TODO/FIXME - fill this in */
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_STREAM_DISCORD:
|
||||
ffmpeg_init_config_common(&handle->config);
|
||||
/* TODO/FIXME - fill this in */
|
||||
break;
|
||||
case RECORD_CONFIG_TYPE_STREAM_TWITCH:
|
||||
ffmpeg_init_config_common(&handle->config);
|
||||
/* TODO/FIXME - fill this in */
|
||||
break;
|
||||
default:
|
||||
case RECORD_CONFIG_TYPE_RECORDING_CUSTOM:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ffmpeg_init_config_common(&handle->config, params->config_type);
|
||||
|
||||
if (!ffmpeg_init_muxer_pre(handle))
|
||||
goto error;
|
||||
|
@ -510,11 +510,6 @@ void recording_driver_set_data_ptr(void *data)
|
||||
recording_data = data;
|
||||
}
|
||||
|
||||
bool *recording_driver_get_use_output_dir_ptr(void)
|
||||
{
|
||||
return &recording_use_output_dir;
|
||||
}
|
||||
|
||||
unsigned *recording_driver_get_width(void)
|
||||
{
|
||||
return &recording_width;
|
||||
|
@ -37,9 +37,12 @@ enum record_config_type
|
||||
RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY,
|
||||
RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY,
|
||||
RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY,
|
||||
RECORD_CONFIG_TYPE_STREAM_YOUTUBE,
|
||||
RECORD_CONFIG_TYPE_STREAM_TWITCH,
|
||||
RECORD_CONFIG_TYPE_STREAM_DISCORD
|
||||
RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY,
|
||||
RECORD_CONFIG_TYPE_STREAMING_CUSTOM,
|
||||
RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY,
|
||||
RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY,
|
||||
RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY,
|
||||
RECORD_CONFIG_TYPE_STREAMING_NETPLAY
|
||||
};
|
||||
|
||||
/* Parameters passed to ffemu_new() */
|
||||
@ -187,8 +190,6 @@ void recording_driver_clear_data_ptr(void);
|
||||
|
||||
void recording_driver_set_data_ptr(void *data);
|
||||
|
||||
bool *recording_driver_get_use_output_dir_ptr(void);
|
||||
|
||||
unsigned *recording_driver_get_width(void);
|
||||
|
||||
unsigned *recording_driver_get_height(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user