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

Dave Rice dave at dericed.com
Fri Nov 17 01:27:38 EET 2017


> On Nov 16, 2017, at 6:08 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 
> 2017-11-16 17:54 GMT+01:00 Dave Rice <dave at 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 at 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(-)

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
-- 
2.15.0



More information about the ffmpeg-devel mailing list