diff mbox

[FFmpeg-devel] avformat/ivfenc: Encode the number of frames

Message ID 20191001145902.28552-2-rzumer@tebako.net
State New
Headers show

Commit Message

rzumer@tebako.net Oct. 1, 2019, 2:59 p.m. UTC
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
---
 libavformat/ivfenc.c  | 3 ++-
 libavformat/version.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Carl Eugen Hoyos Oct. 1, 2019, 3:39 p.m. UTC | #1
Am Di., 1. Okt. 2019 um 16:59 Uhr schrieb Raphaël Zumer <rzumer@tebako.net>:
>
> Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
> ---
>  libavformat/ivfenc.c  | 3 ++-
>  libavformat/version.h | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> index adf72117e9..54327f5025 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -53,7 +53,8 @@ static int ivf_write_header(AVFormatContext *s)
>      avio_wl16(pb, par->height);
>      avio_wl32(pb, s->streams[0]->time_base.den);
>      avio_wl32(pb, s->streams[0]->time_base.num);
> -    avio_wl64(pb, 0xFFFFFFFFFFFFFFFFULL);
> +    avio_wl32(pb, s->streams[0]->nb_frames);
> +    avio_wl32(pb, 0xFFFFFFFFUL);

How did you test this patch?

It is wrong to write a time_base and the number of frames
like this, the output make no sense.

Carl Eugen
James Almer Oct. 1, 2019, 3:41 p.m. UTC | #2
On 10/1/2019 11:59 AM, Raphaël Zumer wrote:
> Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
> ---
>  libavformat/ivfenc.c  | 3 ++-
>  libavformat/version.h | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> index adf72117e9..54327f5025 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -53,7 +53,8 @@ static int ivf_write_header(AVFormatContext *s)
>      avio_wl16(pb, par->height);
>      avio_wl32(pb, s->streams[0]->time_base.den);
>      avio_wl32(pb, s->streams[0]->time_base.num);
> -    avio_wl64(pb, 0xFFFFFFFFFFFFFFFFULL);
> +    avio_wl32(pb, s->streams[0]->nb_frames);
> +    avio_wl32(pb, 0xFFFFFFFFUL);

This field is overwritten at the end of the muxing process. The
UINT64_MAX value here is simply a placeholder.

This patch is wrong.
diff mbox

Patch

diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index adf72117e9..54327f5025 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -53,7 +53,8 @@  static int ivf_write_header(AVFormatContext *s)
     avio_wl16(pb, par->height);
     avio_wl32(pb, s->streams[0]->time_base.den);
     avio_wl32(pb, s->streams[0]->time_base.num);
-    avio_wl64(pb, 0xFFFFFFFFFFFFFFFFULL);
+    avio_wl32(pb, s->streams[0]->nb_frames);
+    avio_wl32(pb, 0xFFFFFFFFUL);
 
     return 0;
 }
diff --git a/libavformat/version.h b/libavformat/version.h
index bcd0408d28..426ffb16e4 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@ 
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
 #define LIBAVFORMAT_VERSION_MINOR  33
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \