[xiph-commits] r16359 - trunk/ffmpeg2theora/src
j at svn.xiph.org
j at svn.xiph.org
Wed Jul 29 04:16:55 PDT 2009
Author: j
Date: 2009-07-29 04:16:55 -0700 (Wed, 29 Jul 2009)
New Revision: 16359
Modified:
trunk/ffmpeg2theora/src/ffmpeg2theora.c
trunk/ffmpeg2theora/src/ffmpeg2theora.h
trunk/ffmpeg2theora/src/theorautils.c
Log:
time remaining for first pass
Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c 2009-07-29 03:16:39 UTC (rev 16358)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c 2009-07-29 11:16:55 UTC (rev 16359)
@@ -972,13 +972,15 @@
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 @@
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 @@
video_done = 1;
}
this->frame_count++;
+ if (info.passno == 1)
+ info.videotime = (double)this->frame_count * \
+ this->framerate.den / this->framerate.num;
} while(dups--);
}
}
Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.h
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.h 2009-07-29 03:16:39 UTC (rev 16358)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.h 2009-07-29 11:16:55 UTC (rev 16359)
@@ -85,6 +85,7 @@
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 */
Modified: trunk/ffmpeg2theora/src/theorautils.c
===================================================================
--- trunk/ffmpeg2theora/src/theorautils.c 2009-07-29 03:16:39 UTC (rev 16358)
+++ trunk/ffmpeg2theora/src/theorautils.c 2009-07-29 11:16:55 UTC (rev 16359)
@@ -716,15 +716,25 @@
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 @@
hours, minutes, seconds, hundredths,
info->akbps, info->vkbps,
remaining_hours, remaining_minutes, remaining_seconds,
- estimated_size(info, timebase),
- info->passno
+ estimated_size(info, timebase)
);
}
}
More information about the commits
mailing list