mirror of https://github.com/odrling/Aegisub
parent
4e48317803
commit
acc6e13022
|
@ -112,6 +112,7 @@ public:
|
||||||
|
|
||||||
// Fix for mpeg2 and other formats where decoding a frame is necessary to get information about the stream
|
// Fix for mpeg2 and other formats where decoding a frame is necessary to get information about the stream
|
||||||
if (VideoCodecContext->pix_fmt == PIX_FMT_NONE) {
|
if (VideoCodecContext->pix_fmt == PIX_FMT_NONE) {
|
||||||
|
mkv_SetTrackMask(MF, ~(1 << VideoTrack));
|
||||||
int64_t Dummy;
|
int64_t Dummy;
|
||||||
DecodeNextFrame(DecodeFrame, &Dummy, Env);
|
DecodeNextFrame(DecodeFrame, &Dummy, Env);
|
||||||
mkv_Seek(MF, 0, MKVF_SEEK_TO_PREV_KEYFRAME);
|
mkv_Seek(MF, 0, MKVF_SEEK_TO_PREV_KEYFRAME);
|
||||||
|
@ -245,13 +246,13 @@ public:
|
||||||
if (VideoTrack >= 0) {
|
if (VideoTrack >= 0) {
|
||||||
mkv_SetTrackMask(MF, ~(1 << VideoTrack));
|
mkv_SetTrackMask(MF, ~(1 << VideoTrack));
|
||||||
|
|
||||||
|
// Calculate the average framerate
|
||||||
if (FrameToDTS.size() >= 2) {
|
if (FrameToDTS.size() >= 2) {
|
||||||
double DTSDiff = (double)(FrameToDTS.back().DTS - FrameToDTS.front().DTS);
|
double DTSDiff = (double)(FrameToDTS.back().DTS - FrameToDTS.front().DTS);
|
||||||
VI.fps_denominator = (unsigned int)(DTSDiff * mkv_TruncFloat(VideoTI->TimecodeScale) / (double)1000 / (double)(VI.num_frames - 1) + 0.5);
|
VI.fps_denominator = (unsigned int)(DTSDiff * mkv_TruncFloat(VideoTI->TimecodeScale) / (double)1000 / (double)(VI.num_frames - 1) + 0.5);
|
||||||
VI.fps_numerator = 1000000;
|
VI.fps_numerator = 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!SaveTimecodesToFile(ATimecodes, mkv_TruncFloat(VideoTI->TimecodeScale), 1000000))
|
if (!SaveTimecodesToFile(ATimecodes, mkv_TruncFloat(VideoTI->TimecodeScale), 1000000))
|
||||||
Env->ThrowError("FFmpegSource: Failed to write timecodes");
|
Env->ThrowError("FFmpegSource: Failed to write timecodes");
|
||||||
}
|
}
|
||||||
|
@ -541,6 +542,7 @@ public:
|
||||||
if (!SaveTimecodesToFile(ATimecodes, FormatContext->streams[VideoTrack]->time_base.num * 1000, FormatContext->streams[VideoTrack]->time_base.den))
|
if (!SaveTimecodesToFile(ATimecodes, FormatContext->streams[VideoTrack]->time_base.num * 1000, FormatContext->streams[VideoTrack]->time_base.den))
|
||||||
Env->ThrowError("FFmpegSource: Failed to write timecodes");
|
Env->ThrowError("FFmpegSource: Failed to write timecodes");
|
||||||
|
|
||||||
|
// Adjust framerate to match the duration of the first frame
|
||||||
if (FrameToDTS.size() >= 2) {
|
if (FrameToDTS.size() >= 2) {
|
||||||
int64_t DTSDiff = (double)(FrameToDTS[1].DTS - FrameToDTS[0].DTS);
|
int64_t DTSDiff = (double)(FrameToDTS[1].DTS - FrameToDTS[0].DTS);
|
||||||
VI.fps_denominator *= DTSDiff;
|
VI.fps_denominator *= DTSDiff;
|
||||||
|
|
|
@ -9,6 +9,11 @@ FFmpegSource Documentation
|
||||||
|
|
||||||
<h2>Changes</h2>
|
<h2>Changes</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>1.7<ul>
|
||||||
|
<li>Updated FFmpeg</li>
|
||||||
|
<li>Fixed error with mkv for codecs without codec private data and the first packet doesn't belong to them</li>
|
||||||
|
</ul></li>
|
||||||
|
|
||||||
<li>1.6<ul>
|
<li>1.6<ul>
|
||||||
<li>Fixed ac3 and other formats stored in mkv</li>
|
<li>Fixed ac3 and other formats stored in mkv</li>
|
||||||
<li>Skip unnecessary seeking when index information already exists (gif file opening only 3/4 broken now)</li>
|
<li>Skip unnecessary seeking when index information already exists (gif file opening only 3/4 broken now)</li>
|
||||||
|
|
Loading…
Reference in New Issue