Revision 47b229db ffmpeg.c
ffmpeg.c | ||
---|---|---|
900 | 900 |
AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src; |
901 | 901 |
AVFrame picture_crop_temp, picture_pad_temp; |
902 | 902 |
AVCodecContext *enc, *dec; |
903 |
double sync_ipts; |
|
903 | 904 |
|
904 | 905 |
avcodec_get_frame_defaults(&picture_crop_temp); |
905 | 906 |
avcodec_get_frame_defaults(&picture_pad_temp); |
... | ... | |
907 | 908 |
enc = ost->st->codec; |
908 | 909 |
dec = ist->st->codec; |
909 | 910 |
|
911 |
sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base); |
|
912 |
|
|
910 | 913 |
/* by default, we output a single frame */ |
911 | 914 |
nb_frames = 1; |
912 | 915 |
|
... | ... | |
914 | 917 |
|
915 | 918 |
if(video_sync_method){ |
916 | 919 |
double vdelta; |
917 |
vdelta = get_sync_ipts(ost) / av_q2d(enc->time_base) - ost->sync_opts;
|
|
920 |
vdelta = sync_ipts - ost->sync_opts;
|
|
918 | 921 |
//FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c |
919 | 922 |
if (vdelta < -1.1) |
920 | 923 |
nb_frames = 0; |
... | ... | |
922 | 925 |
if(vdelta<=-0.6){ |
923 | 926 |
nb_frames=0; |
924 | 927 |
}else if(vdelta>0.6) |
925 |
ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base));
|
|
928 |
ost->sync_opts= lrintf(sync_ipts);
|
|
926 | 929 |
}else if (vdelta > 1.1) |
927 | 930 |
nb_frames = lrintf(vdelta); |
928 | 931 |
//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames); |
... | ... | |
936 | 939 |
fprintf(stderr, "*** %d dup!\n", nb_frames-1); |
937 | 940 |
} |
938 | 941 |
}else |
939 |
ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base));
|
|
942 |
ost->sync_opts= lrintf(sync_ipts);
|
|
940 | 943 |
|
941 | 944 |
nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number); |
942 | 945 |
if (nb_frames <= 0) |
Also available in: Unified diff