[FFmpeg-cvslog] avconv: fix bitrate report when writing to /dev/null
Janne Grunau
git at videolan.org
Fri Oct 26 14:46:01 CEST 2012
ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Tue Oct 9 23:22:49 2012 +0200| [1b891d17c531e8a63c2974aab4bf997ce70746f3] | committer: Janne Grunau
avconv: fix bitrate report when writing to /dev/null
avio_size() reports the filesize which returns 0 for /dev/null.
avio_tell() reports the current position.
Also handle errors from avio_tell().
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b891d17c531e8a63c2974aab4bf997ce70746f3
---
avconv.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/avconv.c b/avconv.c
index bf1e2fa..54a0e2a 100644
--- a/avconv.c
+++ b/avconv.c
@@ -807,8 +807,15 @@ static void print_report(int is_last_report, int64_t timer_start)
oc = output_files[0]->ctx;
total_size = avio_size(oc->pb);
- if (total_size < 0) // FIXME improve avio_size() so it works with non seekable output too
+ if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too
total_size = avio_tell(oc->pb);
+ if (total_size < 0) {
+ char errbuf[128];
+ av_strerror(total_size, errbuf, sizeof(errbuf));
+ av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
+ "avio_tell() failed: %s\n", errbuf);
+ total_size = 0;
+ }
buf[0] = '\0';
ti1 = 1e10;
More information about the ffmpeg-cvslog
mailing list