Skip to content

Commit

Permalink
Added profile settings for x264
Browse files Browse the repository at this point in the history
  • Loading branch information
Keukhan committed Nov 12, 2024
1 parent 7a8000e commit 2ec8124
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/projects/transcoder/codec/encoder/encoder_avc_x264.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ bool EncoderAVCx264::SetCodecParams()
// >1 => Set
_codec_context->thread_count = GetRefTrack()->GetThreadCount() < 0 ? FFMIN(FFMAX(4, av_cpu_count() / 3), 8) : GetRefTrack()->GetThreadCount();

// Profile
auto profile = GetRefTrack()->GetProfile();
if (profile.IsEmpty() == true)
{
::av_opt_set(_codec_context->priv_data, "profile", "baseline", 0);
}
else
{
if (profile == "baseline")
{
::av_opt_set(_codec_context->priv_data, "profile", "baseline", 0);
}
else if (profile == "main")
{
::av_opt_set(_codec_context->priv_data, "profile", "main", 0);
}
else if (profile == "high")
{
::av_opt_set(_codec_context->priv_data, "profile", "high", 0);
}
else
{
logtw("This is an unknown profile. change to the default(baseline) profile.");
::av_opt_set(_codec_context->priv_data, "profile", "baseline", 0);
}
}

// Preset
if (GetRefTrack()->GetPreset() == "slower")
{
Expand Down Expand Up @@ -81,9 +108,6 @@ bool EncoderAVCx264::SetCodecParams()
::av_opt_set(_codec_context->priv_data, "preset", "faster", 0);
}

// Profile
::av_opt_set(_codec_context->priv_data, "profile", "main", 0);

// Tune
::av_opt_set(_codec_context->priv_data, "tune", "zerolatency", 0);

Expand Down

0 comments on commit 2ec8124

Please sign in to comment.