This works around an issue in the current git version of dash.js.
---
 libavformat/dashenc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 19f8ab6..d12c56e 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -716,8 +716,15 @@ static int dash_write_packet(AVFormatContext *s, AVPacket 
*pkt)
             return ret;
     }
 
-    if (!os->packets_written)
+    if (!os->packets_written) {
         os->start_pts = pkt->pts;
+        if (os->segment_index == 0 && s->avoid_negative_ts == 
AVFMT_AVOID_NEG_TS_MAKE_ZERO &&
+            c->use_template && c->use_timeline) {
+            // Newer dash.js versions have problems when the start pts
+            // isn't zero, even if using a proper Period start.
+            os->start_pts = os->first_pts = 0;
+        }
+    }
     os->max_pts = FFMAX(os->max_pts, pkt->pts + pkt->duration);
     os->packets_written++;
     return ff_write_chained(os->ctx, 0, pkt, s);
-- 
1.9.3 (Apple Git-50)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to