Message ID | DFF4DD27-9BEE-4EC8-BAF4-7048F1A32B01@dericed.com |
---|---|
State | Superseded |
Headers | show |
On 7/7/2017 2:20 AM, Dave Rice wrote:
> Currently this patch writes the clap atom under this condition "track->par->codec_id == AV_CODEC_ID_RAWVIDEO & track->mode == MODE_MOV”; however, AV_CODEC_ID_RAWVIDEO isn’t quite what the spec asks for. Any advice on how to write this condition for “uncompressed Y´CbCr data formats”; for instance v210 is considered uncompress Y´CbCr in QuickTime but is not a AV_CODEC_ID_RAWVIDEO. I haven’t found a concise way to add a condition for uncompressed YUV.
First, it should be '&&', I assume.
I don't think there's any concise way of checking such conditions... you'll
probably have to do something like a list of "codes" (v410, v210, raw) and
some sort of sanity check for track->par->format to confirm is is YCbCr.
Maybe someone knows better than myself.
- Derek
> On Jul 6, 2017, at 9:39 PM, Derek Buitenhuis <derek.buitenhuis@gmail.com> wrote: > > On 7/7/2017 2:20 AM, Dave Rice wrote: >> Currently this patch writes the clap atom under this condition "track->par->codec_id == AV_CODEC_ID_RAWVIDEO & track->mode == MODE_MOV”; however, AV_CODEC_ID_RAWVIDEO isn’t quite what the spec asks for. Any advice on how to write this condition for “uncompressed Y´CbCr data formats”; for instance v210 is considered uncompress Y´CbCr in QuickTime but is not a AV_CODEC_ID_RAWVIDEO. I haven’t found a concise way to add a condition for uncompressed YUV. > > First, it should be '&&', I assume. Thanks. > I don't think there's any concise way of checking such conditions... you'll > probably have to do something like a list of "codes" (v410, v210, raw) and > some sort of sanity check for track->par->format to confirm is is YCbCr. > Maybe someone knows better than myself. I see that although it’s mandatory for uncompressed YUV, there’s no constraint to not use it otherwise, so I think I’ll proceed with just a check for MODE_MOV. I just checked ffmbc’s movenc.c and it also only checks for MODE_MOV. Dave Rice
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 88f2f2c819..033e8550b2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1669,6 +1669,21 @@ static int mov_write_sv3d_tag(AVFormatContext *s, AVIOContext *pb, AVSphericalMa return update_size(pb, sv3d_pos); } +static int mov_write_clap_tag(AVIOContext *pb, MOVTrack *track) +{ + avio_wb32(pb, 64); + ffio_wfourcc(pb, "clap"); + avio_wb32(pb, track->par->width); /* aperatureWidth numerator */ + avio_wb32(pb, 1); /* aperatureWidth denominator (= 1) */ + avio_wb32(pb, track->height); /* aperatureHeight numerator */ + avio_wb32(pb, 1); /* aperatureHeight denominator (= 1) */ + avio_wb32(pb, 0); /* horizontal offset numerator (= 0) */ + avio_wb32(pb, 1); /* horizontal offset denominator (= 1) */ + avio_wb32(pb, 0); /* vertical offset numerator (= 0) */ + avio_wb32(pb, 1); /* vertical offset denominator (= 1) */ + return 64; +} + static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) { AVRational sar; @@ -1939,6 +1954,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr av_log(mov->fc, AV_LOG_WARNING, "Not writing 'colr' atom. Format is not MOV or MP4.\n"); } + if (track->par->codec_id == AV_CODEC_ID_RAWVIDEO & track->mode == MODE_MOV) { + mov_write_clap_tag(pb, track); + } + if (track->mode == MODE_MP4 && mov->fc->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) { AVStereo3D* stereo_3d = (AVStereo3D*) av_stream_get_side_data(track->st, AV_PKT_DATA_STEREO3D, NULL); AVSphericalMapping* spherical_mapping = (AVSphericalMapping*)av_stream_get_side_data(track->st, AV_PKT_DATA_SPHERICAL, NULL);
Hi all, I’m looking for some assistance on this patch which is intended to resolve https://trac.ffmpeg.org/ticket/6145 <https://trac.ffmpeg.org/ticket/6145>. In https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html <https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html>, regarding the clap atom, it states "This is a mandatory extension for all uncompressed Y´CbCr data formats”. This patch is intended to write the clap atom in those cases as a coincident with the stored image (not supported a cropped aperature yet), but I’m having trouble associating it with the correct conditional formats. Currently this patch writes the clap atom under this condition "track->par->codec_id == AV_CODEC_ID_RAWVIDEO & track->mode == MODE_MOV”; however, AV_CODEC_ID_RAWVIDEO isn’t quite what the spec asks for. Any advice on how to write this condition for “uncompressed Y´CbCr data formats”; for instance v210 is considered uncompress Y´CbCr in QuickTime but is not a AV_CODEC_ID_RAWVIDEO. I haven’t found a concise way to add a condition for uncompressed YUV. Other comments welcome. Thanks. From a5e399c6eeaa64aef52dc498cc62114428f42941 Mon Sep 17 00:00:00 2001 From: Dave Rice <dave@dericed.com> Date: Thu, 6 Jul 2017 21:12:38 -0400 Subject: [PATCH] movenc: write clap tag --- libavformat/movenc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)