[FFmpeg-devel] [PATCH] mov tkhd' width and height usage

Baptiste Coudurier baptiste.coudurier
Fri Jan 28 21:08:56 CET 2011


On 01/28/2011 06:31 AM, Maksym Veremeyenko wrote:
> Baptiste Coudurier ???????(??):
>> On 01/26/2011 08:34 AM, Ronald S. Bultje wrote:
> [...]
>>> I have no opinion unless it fixes a bug in eg Quicktime. Baptiste?
>>
>> I think we can do that for all formats and write the "pasp" atom for
>> them all. It is now part of ISO Media since the 2008 specifications and
>> last time I tried all players supported it.
>>
>> Maksym, can you please check this ?
>>
>
> i updated a patches.
>
> *pasp* atom did not affect quicktime player in my case, so the proper
> solution is add *clef* atom that really affect player....
>
>
>
> 0001-move-visual-presentation-dims-apertures-from-tkhd-to.patch
>
>
>  From 8a429e0c64dec26bd756f687d80cb5c913f9a2fe Mon Sep 17 00:00:00 2001
> From: Maksym Veremeyenko<verem at m1stereo.tv>
> Date: Fri, 28 Jan 2011 16:06:55 +0200
> Subject: [PATCH 1/2] move visual presentation dims (apertures) from tkhd to clef atom
>
> ---
>   libavformat/movenc.c |   40 +++++++++++++++++++++++++++++++++++-----
>   1 files changed, 35 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 0949d29..8a85cd4 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1215,11 +1215,8 @@ static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
>       /* Track width and height, for visual only */
>       if(st&&  (track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
>                 track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) {
> -        double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);
> -        if(!sample_aspect_ratio || track->height != track->enc->height)
> -            sample_aspect_ratio = 1;
> -        put_be32(pb, sample_aspect_ratio * track->enc->width*0x10000);
> -        put_be32(pb, track->height*0x10000);
> +        put_be32(pb, track->enc->width<<  16);
> +        put_be32(pb, track->height<<  16);
>       }
>       else {
>           put_be32(pb, 0);
> @@ -1228,6 +1225,36 @@ static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
>       return 0x5c;
>   }
>
> +static int mov_write_clef_tag(ByteIOContext *pb, MOVTrack *track)
> +{
> +    int32_t width;
> +    double sample_aspect_ratio;
> +
> +    sample_aspect_ratio = av_q2d(track->enc->sample_aspect_ratio);
> +
> +    if(!sample_aspect_ratio || track->height != track->enc->height)
> +        sample_aspect_ratio = 1;

In that you must not write the atom.

Let me check the situation first.

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list