diff --git a/ffserver.c b/ffserver.c
index 696c9a94ad83f6d646f97107d3533d1bf86c15ce..30da29dcb35a9f50f0bbd241728c737784061258 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2175,6 +2175,14 @@ static int http_prepare_data(HTTPContext *c)
                             /* XXX: potential leak */
                             return -1;
                         }
+                        if (pkt.dts != AV_NOPTS_VALUE)
+                            pkt.dts = av_rescale_q(pkt.dts,
+                                c->fmt_in->streams[pkt.stream_index]->time_base,
+                                ctx->streams[pkt.stream_index]->time_base);
+                        if (pkt.pts != AV_NOPTS_VALUE)
+                            pkt.pts = av_rescale_q(pkt.pts,
+                                c->fmt_in->streams[pkt.stream_index]->time_base,
+                                ctx->streams[pkt.stream_index]->time_base);
                         if (av_write_frame(ctx, &pkt)) {
                             c->state = HTTPSTATE_SEND_DATA_TRAILER;
                         }