diff mbox

[FFmpeg-devel] webm_chunk: Set pts precision to milliseconds

Message ID 1471911203-15869-1-git-send-email-vigneshv@google.com
State Accepted
Commit 42a635ddae21ef4cd879c821a4da7508d345fdf8
Headers show

Commit Message

Vignesh Venkatasubramanian Aug. 23, 2016, 12:13 a.m. UTC
Milliseconds is the de-factor precision for timestamps in
Matroska/WebM media.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
---
 libavformat/webm_chunk.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Vignesh Venkatasubramanian Aug. 25, 2016, 6:46 p.m. UTC | #1
On Mon, Aug 22, 2016 at 5:13 PM, Vignesh Venkatasubramanian
<vigneshv@google.com> wrote:
> Milliseconds is the de-factor precision for timestamps in
> Matroska/WebM media.
>
> Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
> ---
>  libavformat/webm_chunk.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
> index 9db4fab..44a1695 100644
> --- a/libavformat/webm_chunk.c
> +++ b/libavformat/webm_chunk.c
> @@ -110,6 +110,7 @@ static int webm_chunk_write_header(AVFormatContext *s)
>      WebMChunkContext *wc = s->priv_data;
>      AVFormatContext *oc = NULL;
>      int ret;
> +    int i;
>
>      // DASH Streams can only have either one track per file.
>      if (s->nb_streams != 1) { return AVERROR_INVALIDDATA; }
> @@ -135,6 +136,10 @@ static int webm_chunk_write_header(AVFormatContext *s)
>      if (ret < 0)
>          return ret;
>      ff_format_io_close(s, &oc->pb);
> +    for (i = 0; i < s->nb_streams; i++) {
> +        // ms precision is the de-facto standard timescale for mkv files.
> +        avpriv_set_pts_info(s->streams[i], 64, 1, 1000);
> +    }
>      return 0;
>  }
>
> --
> 2.8.0.rc3.226.g39d4020
>

Can somebody take a look at this please? This fixes timestamp writing
issues in the webm chunk muxer. Thanks!
Michael Niedermayer Aug. 25, 2016, 8:26 p.m. UTC | #2
On Mon, Aug 22, 2016 at 05:13:23PM -0700, Vignesh Venkatasubramanian wrote:
> Milliseconds is the de-factor precision for timestamps in
> Matroska/WebM media.
> 
> Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
> ---
>  libavformat/webm_chunk.c | 5 +++++
>  1 file changed, 5 insertions(+)

applied

thanks


[...]
diff mbox

Patch

diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index 9db4fab..44a1695 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -110,6 +110,7 @@  static int webm_chunk_write_header(AVFormatContext *s)
     WebMChunkContext *wc = s->priv_data;
     AVFormatContext *oc = NULL;
     int ret;
+    int i;
 
     // DASH Streams can only have either one track per file.
     if (s->nb_streams != 1) { return AVERROR_INVALIDDATA; }
@@ -135,6 +136,10 @@  static int webm_chunk_write_header(AVFormatContext *s)
     if (ret < 0)
         return ret;
     ff_format_io_close(s, &oc->pb);
+    for (i = 0; i < s->nb_streams; i++) {
+        // ms precision is the de-facto standard timescale for mkv files.
+        avpriv_set_pts_info(s->streams[i], 64, 1, 1000);
+    }
     return 0;
 }