[FFmpeg-devel] [PATCH] avformat/movenc : Don't write sidx for empty urls

Karthick J kjeyapal at akamai.com
Wed Nov 28 16:40:11 EET 2018


When movenc is used by other segmenting muxers such as dashenc, url field is always empty.
In such cases it is better to not write sidx, instead of throwing errors.
---
 libavformat/movenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6dab5193b0..150a505a4a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6706,6 +6706,9 @@ static int mov_write_trailer(AVFormatContext *s)
            mov->tracks[i].data_offset = 0;
         if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) {
             int64_t end;
+            // If url is an empty string("") don't write sidx atom.
+            if (s->url[0] == '\0')
+                return res;
             av_log(s, AV_LOG_INFO, "Starting second pass: inserting sidx atoms\n");
             res = shift_data(s);
             if (res < 0)
-- 
2.17.1 (Apple Git-112)



More information about the ffmpeg-devel mailing list