diff --git a/ivfdec.c b/ivfdec.c
index 4a0816ff0aeee1a6a66fe00aece1df777669b565..a37a44c07771c6ec7be5ff7b6e664aba74a3aec5 100644
--- a/ivfdec.c
+++ b/ivfdec.c
@@ -17,11 +17,6 @@ int file_is_ivf(struct VpxInputContext *input_ctx) {
   char raw_hdr[32];
   int is_ivf = 0;
 
-  // TODO(tomfinegan): This can eventually go away, but for now it's required
-  // because the means by which file types are detected differ in vpxdec and
-  // vpxenc.
-  rewind(input_ctx->file);
-
   if (fread(raw_hdr, 1, 32, input_ctx->file) == 32) {
     if (raw_hdr[0] == 'D' && raw_hdr[1] == 'K' &&
         raw_hdr[2] == 'I' && raw_hdr[3] == 'F') {
diff --git a/vpxenc.c b/vpxenc.c
index d0ed9b538eb5b0ebd52dc9e7e72d5f66bec1830a..4c933ce6f7e5d25f6e114c820244d6b9e2021e45 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -26,7 +26,6 @@
 
 #include "third_party/libyuv/include/libyuv/scale.h"
 #include "./args.h"
-#include "./ivfdec.h"
 #include "./ivfenc.h"
 
 #if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
@@ -126,13 +125,19 @@ int read_frame(struct VpxInputContext *input_ctx, vpx_image_t *img) {
   return !shortread;
 }
 
-int file_is_y4m(FILE *infile, y4m_input *y4m, const char detect[4]) {
+int file_is_y4m(const char detect[4]) {
   if (memcmp(detect, "YUV4", 4) == 0) {
     return 1;
   }
   return 0;
 }
 
+int fourcc_is_ivf(const char detect[4]) {
+  if (memcmp(detect, "DKIF", 4) == 0) {
+    return 1;
+  }
+  return 0;
+}
 
 /* Murmur hash derived from public domain reference implementation at
  *   http:// sites.google.com/site/murmurhash/
@@ -1044,7 +1049,7 @@ void open_input_file(struct VpxInputContext *input) {
   input->detect.position = 0;
 
   if (input->detect.buf_read == 4
-      && file_is_y4m(input->file, &input->y4m, input->detect.buf)) {
+      && file_is_y4m(input->detect.buf)) {
     if (y4m_input_open(&input->y4m, input->file, input->detect.buf, 4,
                        input->only_i420) >= 0) {
       input->file_type = FILE_TYPE_Y4M;
@@ -1055,7 +1060,7 @@ void open_input_file(struct VpxInputContext *input) {
       input->use_i420 = 0;
     } else
       fatal("Unsupported Y4M stream.");
-  } else if (input->detect.buf_read == 4 && file_is_ivf(input)) {
+  } else if (input->detect.buf_read == 4 && fourcc_is_ivf(input->detect.buf)) {
     fatal("IVF is not supported as input.");
   } else {
     input->file_type = FILE_TYPE_RAW;