[FFmpeg-devel] [PATCH 6/7] mxfdec: set sample aspect ratio for uncomp rec601

Michael Niedermayer michaelni at gmx.at
Tue Jul 3 16:10:47 CEST 2012


On Tue, Feb 28, 2012 at 10:36:16AM -0800, Baptiste Coudurier wrote:
> On 02/28/2012 06:16 AM, Philip de Nier wrote:
> >---
> >  libavformat/mxfdec.c |   16 ++++++++++++++++
> >  1 files changed, 16 insertions(+), 0 deletions(-)
> >
> >diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> >index 3af970d..563eb8f 100644
> >--- a/libavformat/mxfdec.c
> >+++ b/libavformat/mxfdec.c
> >@@ -897,6 +897,8 @@ static const MXFCodecUL mxf_sound_essence_container_uls[] = {
> >      { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,      CODEC_ID_NONE },
> >  };
> >
> >+static UID mxf_unc_rec601_ul = { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x05,0x01,0x00 };
> >+
> >  static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments)
> >  {
> >      int i, j, nb_segments = 0;
> >@@ -1424,6 +1426,20 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
> >                      }
> >                  }
> >              }
> >+            if ((st->codec->codec_id == CODEC_ID_RAWVIDEO || st->codec->codec_id == CODEC_ID_V210)&&
> >+                mxf_match_uid(mxf_unc_rec601_ul, *essence_container_ul, 15)&&  descriptor->width == 720) {
> >+                if (material_track->edit_rate.num == 25&&  material_track->edit_rate.den == 1) {
> >+                    if (descriptor->aspect_ratio.num == 4&&  descriptor->aspect_ratio.den == 3)
> >+                    st->codec->sample_aspect_ratio = (AVRational){59, 54};
> >+                    else if (descriptor->aspect_ratio.num == 16&&  descriptor->aspect_ratio.den == 9)
> >+                    st->codec->sample_aspect_ratio = (AVRational){118, 81};
> >+                } else if (material_track->edit_rate.num == 30000&&  material_track->edit_rate.den == 1001) {
> >+                    if (descriptor->aspect_ratio.num == 4&&  descriptor->aspect_ratio.den == 3)
> >+                        st->codec->sample_aspect_ratio = (AVRational){10, 11};
> >+                    else if (descriptor->aspect_ratio.num == 16&&  descriptor->aspect_ratio.den == 9)
> >+                        st->codec->sample_aspect_ratio = (AVRational){40, 33};
> >+                }
> >+            }
> >              st->need_parsing = AVSTREAM_PARSE_HEADERS;
> >          } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
> >              container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);
> 
> This one I'm hesitating. The problem is that setting sample aspect ratio to these values will break
> the rule width/height == dar/par which is expected in many places.
> I believe sample aspect ratio should follow the rule and another
> field like clean aperture should be exported.
> Furthermore, this assume the source is analog and not digital.
> Michael ?

my reply is a little late but ...

sample_aspect_ratio should be set correctly, i do not know if its
more correct before or after this patch or if something entirely
differently is needed.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120703/90841809/attachment.asc>


More information about the ffmpeg-devel mailing list