Opened 7 years ago

Closed 7 years ago

#5903 closed defect (duplicate)

remuxing to Matroska has inaccurate (slightly) display aspect ratio

Reported by: dave rice Owned by:
Priority: normal Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

To demonstate I'm using a reference file in mov created via:

ffmpeg -f lavfi -i testsrc=s=720x480 -frames:v 1 -aspect 15/11 s720x480_dar15x11.mov

Then remux to mkv via:

drice:scripts drice$ ffmpeg -i s720x480_dar15x11.mov -c copy s720x480_dar15x11.mkv
ffmpeg version git-2016-10-21-5db3c94 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-5db3c94 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libass --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2/include/openjpeg-2.1 --enable-vda
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 63.103 / 57. 63.103
  libavformat    57. 52.100 / 57. 52.100
  libavdevice    57.  0.103 / 57.  0.103
  libavfilter     6. 64.100 /  6. 64.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 's720x480_dar15x11.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf57.52.100
  Duration: 00:00:00.04, start: 0.000000, bitrate: 1039 kb/s
    Stream #0:0(eng): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 720x480 [SAR 10:11 DAR 15:11], 869 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.63.103 libx264
Output #0, matroska, to 's720x480_dar15x11.mkv':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf57.52.100
    Stream #0:0(eng): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 720x480 [SAR 10:11 DAR 15:11], q=2-31, 869 kb/s, 25 fps, 25 tbr, 1k tbn, 12800 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.63.103 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-1.0 Lsize=       5kB time=00:00:00.00 bitrate=42232.0kbits/s speed=3.37x    
video:4kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 21.412144%

In the resulting MKV file it has these values in the Video Element:

PixelWidth=720
PixelHeight=480
DisplayWidth=655
DisplayHeight=480
DisplayUnit={unstored, thus defaults to '0' which is 'pixels'}

This creates a minor DAR change since:

mov's DAR is (720/480)*(10/11) ~= 1.3636363636
mkv's DAR is 655/480 ~= 1.3645833333

If the file was remuxed with these values:

PixelWidth=720
PixelHeight=480
DisplayWidth=15
DisplayHeight=11
DisplayUnit=3 (3 means 'Display Aspect Ratio')

then the mov and the mkv would have an exact match for DAR.

Change History (1)

comment:1 by Carl Eugen Hoyos, 7 years ago

Keywords: matroska removed
Resolution: duplicate
Status: newclosed

See #5743.

Note: See TracTickets for help on using tickets.