mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-15 03:34:56 +00:00
This fixes the jerky video from vob files. However, I am convinced that this
is the wrong solution to the problem. In particular, if you specify an output frame rate, then it doesn't work correctly. My feeling is that the pts value ought to be interpolated between those frames where the pts is actually known. Maybe someone else could do that (change the line that I added, setting a value equal to AV_NOPTS_VALUE). Happy Christmas. Originally committed as revision 1361 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
18531e5233
commit
be4ce15743
7
ffmpeg.c
7
ffmpeg.c
@ -555,16 +555,18 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
|
|
||||||
if (ost->sync_ipts != AV_NOPTS_VALUE) {
|
if (ost->sync_ipts != AV_NOPTS_VALUE) {
|
||||||
vdelta = (double)(ost->st->pts.val) * s->pts_num / s->pts_den - (ost->sync_ipts - ost->sync_ipts_offset);
|
vdelta = (double)(ost->st->pts.val) * s->pts_num / s->pts_den - (ost->sync_ipts - ost->sync_ipts_offset);
|
||||||
if (vdelta < 100 && vdelta > -100) {
|
if (vdelta < 100 && vdelta > -100 && ost->sync_ipts_offset) {
|
||||||
if (vdelta < -AV_DELAY_MAX)
|
if (vdelta < -AV_DELAY_MAX)
|
||||||
nb_frames = 2;
|
nb_frames = 2;
|
||||||
else if (vdelta > AV_DELAY_MAX)
|
else if (vdelta > AV_DELAY_MAX)
|
||||||
nb_frames = 0;
|
nb_frames = 0;
|
||||||
} else {
|
} else {
|
||||||
ost->sync_ipts_offset -= vdelta;
|
ost->sync_ipts_offset -= vdelta;
|
||||||
|
if (!ost->sync_ipts_offset)
|
||||||
|
ost->sync_ipts_offset = 0.000001; /* one microsecond */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if defined(PJSG)
|
||||||
{
|
{
|
||||||
static char *action[] = { "drop frame", "copy frame", "dup frame" };
|
static char *action[] = { "drop frame", "copy frame", "dup frame" };
|
||||||
printf("Input PTS %12.6f, output PTS %12.6f: %s\n",
|
printf("Input PTS %12.6f, output PTS %12.6f: %s\n",
|
||||||
@ -1369,6 +1371,7 @@ static int av_encode(AVFormatContext **output_files,
|
|||||||
//printf("ipts=%lld sync_ipts=%f sync_opts=%lld pts.val=%lld pkt.pts=%lld\n", ipts, ost->sync_ipts, ost->sync_opts, ost->st->pts.val, pkt.pts);
|
//printf("ipts=%lld sync_ipts=%f sync_opts=%lld pts.val=%lld pkt.pts=%lld\n", ipts, ost->sync_ipts, ost->sync_opts, ost->st->pts.val, pkt.pts);
|
||||||
} else {
|
} else {
|
||||||
//printf("pts.val=%lld\n", ost->st->pts.val);
|
//printf("pts.val=%lld\n", ost->st->pts.val);
|
||||||
|
ost->sync_ipts = AV_NOPTS_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ost->encoding_needed) {
|
if (ost->encoding_needed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user