diff --git a/ffmpeg.c b/ffmpeg.c
index 0ce61a39bd3f8dab14f36f264756c3f43e7df142..08338120cce08d0ab184dfb3dd6013eab103a781 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -443,6 +443,12 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename)
         st->codec = avcodec_alloc_context();
         memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext));
         s->streams[i] = st;
+
+        if (st->codec->codec_type == CODEC_TYPE_AUDIO && audio_stream_copy)
+            st->stream_copy = 1;
+        else if (st->codec->codec_type == CODEC_TYPE_VIDEO && video_stream_copy)
+            st->stream_copy = 1;
+
         if(st->codec->flags & CODEC_FLAG_BITEXACT)
             nopts = 1;
     }