[FFmpeg-trac] #11582(ffmpeg:new): Please add an option to make the new "elapsed" stat optional
FFmpeg
trac at avcodec.org
Fri Jun 6 10:44:06 EEST 2025
#11582: Please add an option to make the new "elapsed" stat optional
-------------------------------------+----------------------------------
Reporter: Anton1699 | Owner: (none)
Type: enhancement | Status: new
Priority: wish | Component: ffmpeg
Version: unspecified | Resolution:
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+----------------------------------
Comment (by forthrin):
@Gyan: Presets sound great! Example (disregarding backwards compatibility
for now):
{{{
$ ffmpeg -bars
Presets:
none: No progress bar
peek: Estimated encoding time left, estimated target size and filename
term: Most important values within 80 fixed characters (default)
flex: Most important values within dynamic Terminal width
full: Everything
Fields:
frame: Frame number
fps: Frames encoded per second (user time)
etc.
color: Show progress as background color
Variants:
-bar -> key=value
+bar -> value
$ ffmpeg +bar peek,color -i in.mp4 out.mp4
4096M 64m out.mp4
$ ffmpeg +bar frame,q -i in.mp4 out.mp4
1234 28.0
$ ffmpeg -bar frame,q -i in.mp4 out.mp4
frame=1234 q=28.0
}}}
Some questions:
1. Do you think a selection of progress bars belong in a dedicated
`progress.c` file, or best done via `-progress /tmp/fifo` and a script
(eg. Ruby) running alongside FFmpeg?
Using a script eliminates icky string and Unicode handling in C, but begs
the launching of the script and keeping the FIFO continuously
readable/writable from respective sides.
2. `duration` (recording time) is required for ETA and target size. How to
get `recording_time` (recently moved from `InputFile` to `Demuxer`) from
`print_report()` without hacking?
(Must obviously iterate all i/o files to find global maximum recording
time.)
{{{
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index de607cac..3b1794fa 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -687,2 +687,4 @@ static void print_report(int is_last_report, int64_t
timer_start, int64_t cur_ti
av_bprintf(&buf, " elapsed=%"PRId64":%02d:%02d.%02d", hours, mins,
secs, ms / 10);
+ av_bprintf(&buf_script, "duration=%lld\n",
FFMIN(input_files[0]->ctx->duration, input_files[0]->recording_time));
+ av_bprintf(&buf_script, "url=%s\n", output_files[0]->url);
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7868f3d8..a97fca05 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -506,3 +506,3 @@ typedef struct InputFile {
int64_t start_time;
-
+ int64_t recording_time; //
git.ffmpeg.org/gitweb/ffmpeg.git/commit/8f592
/* streams that ffmpeg is aware of;
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index cb4318c7..f8201fd2 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1875,3 +1875,3 @@ int ifile_open(const OptionsContext *o, const char
*filename, Scheduler *sch)
f->start_time = start_time;
- d->recording_time = recording_time;
+ f->recording_time = d->recording_time = recording_time; // HACK
f->input_sync_ref = o->input_sync_ref;
}}}
Then:
{{{
columns = current_width_of_terminal
est_size = (duration / out_time_ms) * total_size / 1_000_000
est_time = (duration - out_time_ms) / speed / 1_000_000
progress = columns * est_time / duration
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11582#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list