diff --git a/src/flac/encode.c b/src/flac/encode.c
index 59a6e4b..54c031c 100644
--- a/src/flac/encode.c
+++ b/src/flac/encode.c
@@ -1111,7 +1111,6 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
 				encoder_session.fmt.iff.data_bytes -= skip * encoder_session.info.bytes_per_wide_sample;
 				if(options.ignore_chunk_sizes) {
 					encoder_session.total_samples_to_encode = 0;
-					flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n");
 					FLAC__ASSERT(0 == until);
 				}
 				else {
@@ -1145,47 +1144,50 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
 			else
 				encoder_session.total_samples_to_encode -= align_remainder; /* will stop short and carry over to next file */
 		}
-		switch(options.format) {
-			case FORMAT_RAW:
-				encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample;
-				break;
-			case FORMAT_WAVE:
-				/* +44 for the size of the WAVE headers; this is just an estimate for the progress indicator and doesn't need to be exact */
-				encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 44;
-				break;
-			case FORMAT_WAVE64:
-				/* +44 for the size of the WAVE headers; this is just an estimate for the progress indicator and doesn't need to be exact */
-				encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 104;
-				break;
-			case FORMAT_RF64:
-				/* +72 for the size of the RF64 headers; this is just an estimate for the progress indicator and doesn't need to be exact */
-				encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 80;
-				break;
-			case FORMAT_AIFF:
-			case FORMAT_AIFF_C:
-				/* +54 for the size of the AIFF headers; this is just an estimate for the progress indicator and doesn't need to be exact */
-				encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 54;
-				break;
-			case FORMAT_FLAC:
-			case FORMAT_OGGFLAC:
-				if(infilesize < 0)
-					/* if we don't know, use 0 as hint to progress indicator (which is the only place this is used): */
-					encoder_session.unencoded_size = 0;
-				else if(skip == 0 && until == 0)
-					encoder_session.unencoded_size = (FLAC__uint64)infilesize;
-				else if(total_samples_in_input)
-					encoder_session.unencoded_size = (FLAC__uint64)infilesize * encoder_session.total_samples_to_encode / total_samples_in_input;
-				else
-					encoder_session.unencoded_size = (FLAC__uint64)infilesize;
-				break;
-			default:
-				FLAC__ASSERT(0);
-				/* double protection */
-				return EncoderSession_finish_error(&encoder_session);
+		if(encoder_session.total_samples_to_encode) {
+			switch(options.format) {
+				case FORMAT_RAW:
+					encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample;
+					break;
+				case FORMAT_WAVE:
+					/* +44 for the size of the WAVE headers; this is just an estimate for the progress indicator and doesn't need to be exact */
+					encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 44;
+					break;
+				case FORMAT_WAVE64:
+					/* +44 for the size of the WAVE headers; this is just an estimate for the progress indicator and doesn't need to be exact */
+					encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 104;
+					break;
+				case FORMAT_RF64:
+					/* +72 for the size of the RF64 headers; this is just an estimate for the progress indicator and doesn't need to be exact */
+					encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 80;
+					break;
+				case FORMAT_AIFF:
+				case FORMAT_AIFF_C:
+					/* +54 for the size of the AIFF headers; this is just an estimate for the progress indicator and doesn't need to be exact */
+					encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 54;
+					break;
+				case FORMAT_FLAC:
+				case FORMAT_OGGFLAC:
+					if(infilesize < 0)
+						/* if we don't know, use 0 as hint to progress indicator (which is the only place this is used): */
+						encoder_session.unencoded_size = 0;
+					else if(skip == 0 && until == 0)
+						encoder_session.unencoded_size = (FLAC__uint64)infilesize;
+					else if(total_samples_in_input)
+						encoder_session.unencoded_size = (FLAC__uint64)infilesize * encoder_session.total_samples_to_encode / total_samples_in_input;
+					else
+						encoder_session.unencoded_size = (FLAC__uint64)infilesize;
+					break;
+				default:
+					FLAC__ASSERT(0);
+					/* double protection */
+					return EncoderSession_finish_error(&encoder_session);
+			}
 		}
-
-		if(encoder_session.total_samples_to_encode == 0)
+		else {
+			encoder_session.unencoded_size = 0;
 			flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n");
+		}
 
 		if(options.format == FORMAT_FLAC || options.format == FORMAT_OGGFLAC)
 			encoder_session.fmt.flac.client_data.samples_left_to_process = encoder_session.total_samples_to_encode;
@@ -2451,11 +2453,11 @@ void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64
 
 #if defined _MSC_VER || defined __MINGW32__
 	/* with MSVC you have to spoon feed it the casting */
-	e->progress = (double)(FLAC__int64)samples_written / (double)(FLAC__int64)e->total_samples_to_encode;
-	e->compression_ratio = e->progress ? (double)(FLAC__int64)e->bytes_written / ((double)(FLAC__int64)(uesize? uesize:1) * min(1.0, e->progress)) : 0;
+	e->progress = e->total_samples_to_encode ? (double)(FLAC__int64)samples_written / (double)(FLAC__int64)e->total_samples_to_encode : 0;
+	e->compression_ratio = (e->progress && uesize) ? (double)(FLAC__int64)e->bytes_written / ((double)(FLAC__int64)uesize * min(1.0, e->progress)) : 0;
 #else
-	e->progress = (double)samples_written / (double)e->total_samples_to_encode;
-	e->compression_ratio = e->progress ? (double)e->bytes_written / ((double)(uesize? uesize:1) * min(1.0, e->progress)) : 0;
+	e->progress = e->total_samples_to_encode ? (double)samples_written / (double)e->total_samples_to_encode : 0;
+	e->compression_ratio = (e->progress && uesize) ? (double)e->bytes_written / ((double)uesize * min(1.0, e->progress)) : 0;
 #endif
 
 	(void)encoder, (void)total_frames_estimate;
