Index: libhb/muxmp4.c =================================================================== --- libhb/muxmp4.c (revision 1237) +++ libhb/muxmp4.c (working copy) @@ -234,54 +234,12 @@ /* apply the anamorphic transformation matrix if needed */ - if( job->pixel_ratio ) { - - uint8_t* val; - uint8_t nval[38]; - uint32_t *ptr32 = (uint32_t*) (nval + 2); - uint32_t size; - - MP4GetBytesProperty(m->file, "moov.trak.tkhd.reserved3", &val, &size); - - if (size == 38) { - - memcpy(nval, val, size); - + if( job->pixel_ratio ) + { float width, height; width = job->pixel_aspect_width; height = job->pixel_aspect_height; - - uint32_t pixelRatioInt; - if (width >= height) - { - pixelRatioInt = (uint32_t)((width / height) * 0x10000); - -#ifdef WORDS_BIGENDIAN - ptr32[0] = pixelRatioInt; -#else - /* we need to switch the endianness, as the file format expects big endian */ - ptr32[0] = ((pixelRatioInt & 0x000000FF) << 24) + ((pixelRatioInt & 0x0000FF00) << 8) + ((pixelRatioInt & 0x00FF0000) >> 8) + ((pixelRatioInt & 0xFF000000) >> 24); -#endif - - } - else - { - pixelRatioInt = (uint32_t)((height / width) * 0x10000); -#ifdef WORDS_BIGENDIAN - ptr32[4] = pixelRatioInt; -#else - /* we need to switch the endianness, as the file format expects big endian */ - ptr32[4] = ((pixelRatioInt & 0x000000FF) << 24) + ((pixelRatioInt & 0x0000FF00) << 8) + ((pixelRatioInt & 0x00FF0000) >> 8) + ((pixelRatioInt & 0xFF000000) >> 24); -#endif - } - - - if(!MP4SetBytesProperty(m->file, "moov.trak.tkhd.reserved3", nval, size)) { - hb_log("Problem setting transform matrix"); - } - - } - + MP4AddPixelAspectRatio(m->file, mux_data->track, (uint32_t)width, (uint32_t)height); } /* end of transformation matrix */