Commit 6284b6eb authored by Jan Gerber's avatar Jan Gerber
Browse files

time remaining for first pass

parent e975583b
......@@ -972,13 +972,15 @@ void ff2theora_output(ff2theora this) {
if (this->framerate_new.num > 0) {
// new framerate is interger only right now,
// so denominator is always 1
info.ti.fps_numerator = this->framerate_new.num;
info.ti.fps_denominator = this->framerate_new.den;
this->framerate.num = this->framerate_new.num;
this->framerate.den = this->framerate_new.den;
}
else {
info.ti.fps_numerator = vstream_fps.num;
info.ti.fps_denominator = vstream_fps.den;
this->framerate.num = vstream_fps.num;
this->framerate.den = vstream_fps.den;
}
info.ti.fps_numerator = this->framerate.num;
info.ti.fps_denominator = this->framerate.den;
/* this is pixel aspect ratio */
info.ti.aspect_numerator=this->aspect_numerator;
info.ti.aspect_denominator=this->aspect_denominator;
......@@ -1089,6 +1091,7 @@ void ff2theora_output(ff2theora this) {
exit(1);
}
if(info.twopass==3){
info.videotime = 0;
/* 'automatic' second pass */
if(av_seek_frame( this->context, -1, (int64_t)AV_TIME_BASE*this->start_time, 1)<0){
fprintf(stderr,"Could not rewind video input file for second pass!\n");
......@@ -1339,6 +1342,9 @@ void ff2theora_output(ff2theora this) {
video_done = 1;
}
this->frame_count++;
if (info.passno == 1)
info.videotime = (double)this->frame_count * \
this->framerate.den / this->framerate.num;
} while(dups--);
}
}
......
......@@ -85,6 +85,7 @@ typedef struct ff2theora{
double end_time;
AVRational framerate_new;
AVRational framerate;
double pts_offset; /* between given input pts and calculated output pts */
int64_t frame_count; /* total video frames output so far */
......
......@@ -716,15 +716,25 @@ static void print_stats(oggmux_info *info, double timebase) {
int remaining_hours = (long) remaining / 3600;
if (info->passno==1) {
remaining = time(NULL) - info->start_time;
remaining_seconds = (long) remaining % 60;
remaining_minutes = ((long) remaining / 60) % 60;
remaining_hours = (long) remaining / 3600;
fprintf (stderr,"\r Scanning video first pass, time elapsed: %02d:%02d:%02d ",
remaining_hours, remaining_minutes, remaining_seconds
);
}
else if (timebase - last > 0.5) {
if (timebase - last > 0.5 || timebase < last) {
last = timebase;
if (info->frontend) {
fprintf(info->frontend, "{\"duration\": %lf, \"position\": %.02lf, \"remaining\": %.02lf}\n",
(double)info->duration,
timebase,
remaining
);
fflush (info->frontend);
} else {
fprintf (stderr,"\rScanning first pass pos: %d:%02d:%02d.%02d ET: %02d:%02d:%02d ",
hours, minutes, seconds, hundredths,
remaining_hours, remaining_minutes, remaining_seconds
);
}
}
}
else if (timebase - last > 0.5 || timebase < last) {
last = timebase;
if (info->frontend) {
fprintf(info->frontend, "{\"duration\": %lf, \"position\": %.02lf, \"audio_kbps\": %d, \"video_kbps\": %d, \"remaining\": %.02lf}\n",
......@@ -752,8 +762,7 @@ static void print_stats(oggmux_info *info, double timebase) {
hours, minutes, seconds, hundredths,
info->akbps, info->vkbps,
remaining_hours, remaining_minutes, remaining_seconds,
estimated_size(info, timebase),
info->passno
estimated_size(info, timebase)
);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment