[FFmpeg-devel] [PATCH] avformat/avienc: fix fields-per-frame value for interlaced video streams
Tobias Rapp
t.rapp at noa-archive.com
Mon Nov 20 15:47:10 EET 2017
Fixes ticket #6383.
Signed-off-by: Tobias Rapp <t.rapp at noa-archive.com>
---
libavformat/avienc.c | 10 ++++++++--
libavformat/version.h | 2 +-
tests/ref/fate/copy-trac2211-avi | 2 +-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 483f5b5..b702d9e 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -501,8 +501,14 @@ static int avi_write_header(AVFormatContext *s)
AVRational dar = av_mul_q(st->sample_aspect_ratio,
(AVRational) { par->width,
par->height });
- int num, den;
+ int num, den, fields;
av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
+ if (par->field_order == AV_FIELD_TT || par->field_order == AV_FIELD_BB ||
+ par->field_order == AV_FIELD_TB || par->field_order == AV_FIELD_BT) {
+ fields = 2; // interlaced
+ } else {
+ fields = 1; // progressive
+ }
avio_wl32(pb, 0); // video format = unknown
avio_wl32(pb, 0); // video standard = unknown
@@ -514,7 +520,7 @@ static int avi_write_header(AVFormatContext *s)
avio_wl16(pb, num);
avio_wl32(pb, par->width);
avio_wl32(pb, par->height);
- avio_wl32(pb, 1); // progressive FIXME
+ avio_wl32(pb, fields); // fields per frame
avio_wl32(pb, par->height);
avio_wl32(pb, par->width);
diff --git a/libavformat/version.h b/libavformat/version.h
index feb1461..7fe3710 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 2
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MICRO 103
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/ref/fate/copy-trac2211-avi b/tests/ref/fate/copy-trac2211-avi
index 007349e..82c5609 100644
--- a/tests/ref/fate/copy-trac2211-avi
+++ b/tests/ref/fate/copy-trac2211-avi
@@ -1,4 +1,4 @@
-6f6b211cbc8de9871e8e09e64048e2f9 *tests/data/fate/copy-trac2211-avi.avi
+cdec6984b94933ad42113b35ee246409 *tests/data/fate/copy-trac2211-avi.avi
1777924 tests/data/fate/copy-trac2211-avi.avi
#tb 0: 1/14
#media_type 0: video
--
2.7.4
More information about the ffmpeg-devel
mailing list