diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 679e30611c..2f1275b1ec 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -71,7 +71,7 @@ enum {
 #define MPD_PROFILE_DVB  2
 
 typedef struct Segment {
-    char file[1024];
+    char file[MAX_URL_SIZE];
     int64_t start_pos;
     int range_length, index_length;
     int64_t time;
@@ -104,7 +104,7 @@ typedef struct OutputStream {
     AVCodecParserContext *parser;
     AVCodecContext *parser_avctx;
     int packets_written;
-    char initfile[1024];
+    char initfile[MAX_URL_SIZE];
     int64_t init_start_pos, pos;
     int init_range_length;
     int nb_segments, segments_size, segment_index;
@@ -126,9 +126,9 @@ typedef struct OutputStream {
 
     char codec_str[100];
     int written_len;
-    char filename[1024];
-    char full_path[1024];
-    char temp_path[1024];
+    char filename[MAX_URL_SIZE];
+    char full_path[MAX_URL_SIZE];
+    char temp_path[MAX_URL_SIZE];
     double availability_time_offset;
     AVProducerReferenceTime producer_reference_time;
     char producer_reference_time_str[100];
@@ -161,7 +161,7 @@ typedef struct DASHContext {
     char availability_start_time[100];
     time_t start_time_s;
     int64_t presentation_time_offset;
-    char dirname[1024];
+    char dirname[MAX_URL_SIZE];
     const char *single_file_name;  /* file names as specified in options */
     const char *init_seg_name;
     const char *media_seg_name;
@@ -507,8 +507,8 @@ static void write_hls_media_playlist(OutputStream *os, AVFormatContext *s,
                                      char *prefetch_url) {
     DASHContext *c = s->priv_data;
     int timescale = os->ctx->streams[0]->time_base.den;
-    char temp_filename_hls[1024];
-    char filename_hls[1024];
+    char temp_filename_hls[MAX_URL_SIZE];
+    char filename_hls[MAX_URL_SIZE];
     AVDictionary *http_opts = NULL;
     int target_duration = 0;
     int ret = 0;
@@ -592,7 +592,7 @@ static int flush_init_segment(AVFormatContext *s, OutputStream *os)
 
     os->pos = os->init_range_length = range_length;
     if (!c->single_file) {
-        char filename[1024];
+        char filename[MAX_URL_SIZE];
         snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
         dashenc_io_close(s, &os->out, filename);
     }
@@ -1133,7 +1133,7 @@ static int write_manifest(AVFormatContext *s, int final)
 {
     DASHContext *c = s->priv_data;
     AVIOContext *out;
-    char temp_filename[1024];
+    char temp_filename[MAX_URL_SIZE];
     int ret, i;
     const char *proto = avio_find_protocol_name(s->url);
     int use_rename = proto && !strcmp(proto, "file");
@@ -1246,7 +1246,7 @@ static int write_manifest(AVFormatContext *s, int final)
     }
 
     if (c->hls_playlist) {
-        char filename_hls[1024];
+        char filename_hls[MAX_URL_SIZE];
 
         // Publish master playlist only the configured rate
         if (c->master_playlist_created && (!c->master_publish_rate ||
@@ -1377,7 +1377,7 @@ static int dash_init(AVFormatContext *s)
     DASHContext *c = s->priv_data;
     int ret = 0, i;
     char *ptr;
-    char basename[1024];
+    char basename[MAX_URL_SIZE];
 
     c->nr_of_streams_to_flush = 0;
     if (c->single_file_name)
@@ -1489,7 +1489,7 @@ static int dash_init(AVFormatContext *s)
         AVFormatContext *ctx;
         AVStream *st;
         AVDictionary *opts = NULL;
-        char filename[1024];
+        char filename[MAX_URL_SIZE];
 
         os->bit_rate = s->streams[i]->codecpar->bit_rate;
         if (!os->bit_rate) {
@@ -2316,7 +2316,7 @@ static int dash_write_trailer(AVFormatContext *s)
             dashenc_delete_media_segments(s, os, os->nb_segments);
             dashenc_delete_segment_file(s, os->initfile);
             if (c->hls_playlist && os->segment_type == SEGMENT_TYPE_MP4) {
-                char filename[1024];
+                char filename[MAX_URL_SIZE];
                 get_hls_playlist_name(filename, sizeof(filename), c->dirname, i);
                 dashenc_delete_file(s, filename);
             }
@@ -2324,7 +2324,7 @@ static int dash_write_trailer(AVFormatContext *s)
         dashenc_delete_file(s, s->url);
 
         if (c->hls_playlist && c->master_playlist_created) {
-            char filename[1024];
+            char filename[MAX_URL_SIZE];
             snprintf(filename, sizeof(filename), "%s%s", c->dirname, c->hls_master_name);
             dashenc_delete_file(s, filename);
         }
