Skip to content

Commit

Permalink
--avsyncのデフォルトをautoに改名。音ずれ防止のため、実質的には完全なcfr扱いはしていない。( #562 )
Browse files Browse the repository at this point in the history
  • Loading branch information
rigaya committed Mar 3, 2024
1 parent 90aaf42 commit 4b60cda
Show file tree
Hide file tree
Showing 9 changed files with 247 additions and 249 deletions.
2 changes: 1 addition & 1 deletion NVEnc/encode/auo_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static DWORD video_output_inside(CONF_GUIEX *conf, const OUTPUT_INFO *oip, PRM_E
enc_prm.input.dstHeight = 0;
}

enc_prm.common.AVSyncMode = (conf->vid.afs) ? RGY_AVSYNC_VFR : RGY_AVSYNC_ASSUME_CFR;
enc_prm.common.AVSyncMode = (conf->vid.afs) ? RGY_AVSYNC_VFR : RGY_AVSYNC_AUTO;
enc_prm.common.disableMp4Opt = pe->muxer_to_be_used != MUXER_DISABLED;
if (conf->vid.afs && enc_prm.vpp.afs.enable) {
write_log_auo_line(LOG_ERROR, g_auo_mes.get(AUO_VIDEO_AFS_AVIUTL_AND_VPP_CONFLICT1));
Expand Down
3 changes: 1 addition & 2 deletions NVEncC_Options.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,7 @@ Set global metadata for output file.
```

### --avsync <string>
- cfr (default)
The input will be assumed as CFR and input pts will not be checked.
- auto (default)

- forcecfr
Check pts from the input file, and duplicate or remove frames if required to keep CFR, so that synchronization with the audio could be maintained. Please note that this could not be used with --trim.
Expand Down
3 changes: 1 addition & 2 deletions NVEncC_Options.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -1542,8 +1542,7 @@ mux時にオプションパラメータを渡す。<string1>にオプシ
```

### --avsync <string>
- cfr (default)
入力はCFRを仮定し、入力ptsをチェックしない。
- auto (default)

- forcecfr
入力ptsを見ながら、CFRに合うようフレームの水増し・間引きを行い、音声との同期が維持できるようにする。主に、入力がvfrやRFFなどのときに音ズレしてしまう問題への対策。また、--trimとは併用できない。
Expand Down
461 changes: 230 additions & 231 deletions NVEncC_Options.zh-cn.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions NVEncCore/NVEncCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ NVEncCore::NVEncCore() :
m_sar(),
m_encVUI(),
m_nProcSpeedLimit(0),
m_nAVSyncMode(RGY_AVSYNC_ASSUME_CFR),
m_nAVSyncMode(RGY_AVSYNC_AUTO),
m_timestampPassThrough(false),
m_inputFps(),
m_outputTimebase(),
Expand Down Expand Up @@ -598,9 +598,9 @@ NVENCSTATUS NVEncCore::InitInput(InEncodeVideoParam *inputParam, const std::vect
frucfps = m_inputFps * 2;
break;
case VppFrucMode::NVOFFRUCFps:
frucfps = inputParam->vpp.fruc.targetFps;
frucfps = inputParam->vpp.fruc.targetFps;
break;
default:
default:
break;
}
if (frucfps.is_valid()) {
Expand Down Expand Up @@ -4960,7 +4960,7 @@ tstring NVEncCore::GetEncodingParamsInfo(int output_level) {
}
add_str(RGY_LOG_ERROR, _T("[offset: %d]\n"), m_trimParam.offset);
}
if (m_nAVSyncMode != RGY_AVSYNC_ASSUME_CFR) {
if (m_nAVSyncMode & RGY_AVSYNC_FORCE_CFR) {
add_str(RGY_LOG_ERROR, _T("AVSync %s\n"), get_chr_from_value(list_avsync, m_nAVSyncMode));
}
tstring vppFilterMes;
Expand Down
9 changes: 5 additions & 4 deletions NVEncCore/rgy_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ struct VideoInfo {
};

enum RGYAVSync : uint32_t {
RGY_AVSYNC_ASSUME_CFR = 0x00,
RGY_AVSYNC_AUTO = 0x00,
RGY_AVSYNC_FORCE_CFR = 0x01,
RGY_AVSYNC_VFR = 0x02,
};
Expand Down Expand Up @@ -794,9 +794,10 @@ static bool is_list_empty(const CX_DESC *list) {
extern const CX_DESC list_log_level[];

const CX_DESC list_avsync[] = {
{ _T("cfr"), RGY_AVSYNC_ASSUME_CFR },
{ _T("vfr"), RGY_AVSYNC_VFR },
{ _T("forcecfr"), RGY_AVSYNC_FORCE_CFR },
{ _T("auto"), RGY_AVSYNC_AUTO },
{ _T("cfr"), RGY_AVSYNC_AUTO },
{ _T("vfr"), RGY_AVSYNC_VFR },
{ _T("forcecfr"), RGY_AVSYNC_FORCE_CFR },
{ NULL, 0 }
};

Expand Down
6 changes: 3 additions & 3 deletions NVEncCore/rgy_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ static RGY_ERR initOtherReaders(
inputInfoAVAudioReader.ppAudioSelect = (AudioSelect **)select.data();
}
inputInfoAVAudioReader.procSpeedLimit = ctrl->procSpeedLimit;
inputInfoAVAudioReader.AVSyncMode = RGY_AVSYNC_ASSUME_CFR;
inputInfoAVAudioReader.AVSyncMode = RGY_AVSYNC_AUTO;
inputInfoAVAudioReader.seekSec = common->seekSec;
inputInfoAVAudioReader.seekToSec = common->seekToSec;
inputInfoAVAudioReader.logFramePosList = ctrl->logFramePosList.getFilename(src.filename, _T(".framelist.csv"));
Expand Down Expand Up @@ -614,7 +614,7 @@ RGY_ERR initReaders(
inputInfoAVCuvid.ppAttachmentSelect = common->ppAttachmentSelectList;
inputInfoAVCuvid.nAttachmentSelectCount = common->nAttachmentSelectCount;
inputInfoAVCuvid.procSpeedLimit = ctrl->procSpeedLimit;
inputInfoAVCuvid.AVSyncMode = RGY_AVSYNC_ASSUME_CFR;
inputInfoAVCuvid.AVSyncMode = RGY_AVSYNC_AUTO;
inputInfoAVCuvid.seekSec = common->seekSec;
inputInfoAVCuvid.seekToSec = common->seekToSec;
inputInfoAVCuvid.logFramePosList = ctrl->logFramePosList.getFilename(common->inputFilename, _T(".framelist.csv"));
Expand All @@ -623,7 +623,7 @@ RGY_ERR initReaders(
inputInfoAVCuvid.threadParamInput = ctrl->threadParams.get(RGYThreadType::INPUT);
inputInfoAVCuvid.queueInfo = (perfMonitor) ? perfMonitor->GetQueueInfoPtr() : nullptr;
inputInfoAVCuvid.HWDecCodecCsp = &HWDecCodecCsp;
inputInfoAVCuvid.videoDetectPulldown = !vpp_rff && !vpp_afs && common->AVSyncMode == RGY_AVSYNC_ASSUME_CFR;
inputInfoAVCuvid.videoDetectPulldown = !vpp_rff && !vpp_afs && common->AVSyncMode == RGY_AVSYNC_AUTO;
inputInfoAVCuvid.hdr10plusMetadataCopy = common->hdr10plusMetadataCopy;
inputInfoAVCuvid.parseHDRmetadata = common->maxCll == maxCLLSource || common->masterDisplay == masterDisplaySource;
inputInfoAVCuvid.interlaceAutoFrame = input->picstruct == RGY_PICSTRUCT_AUTO;
Expand Down
2 changes: 1 addition & 1 deletion NVEncCore/rgy_input_avcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ RGYInputAvcodecPrm::RGYInputAvcodecPrm(RGYInputPrm base) :
ppSubtitleSelect(nullptr),
nDataSelectCount(0),
ppDataSelect(nullptr),
AVSyncMode(RGY_AVSYNC_ASSUME_CFR),
AVSyncMode(RGY_AVSYNC_AUTO),
procSpeedLimit(0),
seekSec(0.0f),
seekToSec(0.0f),
Expand Down
2 changes: 1 addition & 1 deletion NVEncCore/rgy_prm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@ RGYParamCommon::RGYParamCommon() :
outReplayCodec(RGY_CODEC_UNKNOWN),
chapterFile(),
AVInputFormat(nullptr),
AVSyncMode(RGY_AVSYNC_ASSUME_CFR), //avsyncの方法 (RGY_AVSYNC_xxx)
AVSyncMode(RGY_AVSYNC_AUTO), //avsyncの方法 (RGY_AVSYNC_xxx)
timestampPassThrough(false),
timecode(false),
timecodeFile(),
Expand Down

0 comments on commit 4b60cda

Please sign in to comment.