diff mbox

[FFmpeg-devel] avformat/movenc: correct ImageDescription depth for v210 v410

Message ID 4FA15371-D5D6-4C99-A5F1-55182F58EC2A@dericed.com
State New
Headers show

Commit Message

Dave Rice Nov. 16, 2017, 11:27 p.m. UTC
> On Nov 16, 2017, at 6:08 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 
> 2017-11-16 17:54 GMT+01:00 Dave Rice <dave@dericed.com>:
> 
>> +    if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V410)
>> +        avio_wb16(pb, 0x18);
>> +    else if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V210)
>> +        avio_wb16(pb, 0x18);
> 
> It appears you can merge the two cases.

The patch is updated with merged cases below.

> Or maybe patch bits_per_coded_sample in the encoder…


With Apple’s TN2162 there doesn’t appear to be a reliable relationship between the bits_per_coded_sample and what the ImageDescription depth value should be for the uncompressed yuv formats. TN2162 simply lists what the depth value should be and this patch corrects the few instances, where ffmpeg’s behavior doesn’t correlate to what TN2162 defines.


From cfa5b2cd959154f2896a9557d9ca2ed2d2d3834e Mon Sep 17 00:00:00 2001
From: Dave Rice <dave@dericed.com>
Date: Thu, 16 Nov 2017 11:53:32 -0500
Subject: [PATCH 2/2] avformat/movenc: correct ImageDescription depth for v210
 v410

Per
https://developer.apple.com/library/content/technotes/tn2162/_index.html
.
---
 libavformat/movenc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Nov. 17, 2017, 5:41 p.m. UTC | #1
On Thu, Nov 16, 2017 at 06:27:38PM -0500, Dave Rice wrote:
> 
> > On Nov 16, 2017, at 6:08 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> > 
> > 2017-11-16 17:54 GMT+01:00 Dave Rice <dave@dericed.com>:
> > 
> >> +    if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V410)
> >> +        avio_wb16(pb, 0x18);
> >> +    else if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V210)
> >> +        avio_wb16(pb, 0x18);
> > 
> > It appears you can merge the two cases.
> 
> The patch is updated with merged cases below.
> 
> > Or maybe patch bits_per_coded_sample in the encoder…
> 
> 
> With Apple’s TN2162 there doesn’t appear to be a reliable relationship between the bits_per_coded_sample and what the ImageDescription depth value should be for the uncompressed yuv formats. TN2162 simply lists what the depth value should be and this patch corrects the few instances, where ffmpeg’s behavior doesn’t correlate to what TN2162 defines.
> 
> 
> From cfa5b2cd959154f2896a9557d9ca2ed2d2d3834e Mon Sep 17 00:00:00 2001
> From: Dave Rice <dave@dericed.com>
> Date: Thu, 16 Nov 2017 11:53:32 -0500
> Subject: [PATCH 2/2] avformat/movenc: correct ImageDescription depth for v210
>  v410

please add a fate test
LGTM if its tested

thx
[...]
diff mbox

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 98fcc7a44b..d9d3c2bf1e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1896,7 +1896,10 @@  static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
     avio_w8(pb, strlen(compressor_name));
     avio_write(pb, compressor_name, 31);
 
-    if (track->mode == MODE_MOV && track->par->bits_per_coded_sample)
+    if (track->mode == MODE_MOV &&
+       (track->par->codec_id == AV_CODEC_ID_V410 || track->par->codec_id == AV_CODEC_ID_V210))
+        avio_wb16(pb, 0x18);
+    else if (track->mode == MODE_MOV && track->par->bits_per_coded_sample)
         avio_wb16(pb, track->par->bits_per_coded_sample |
                   (track->par->format == AV_PIX_FMT_GRAY8 ? 0x20 : 0));
     else