[FFmpeg-devel] [PATCH] libavutil: add clean aperture (CLAP) side data.

Kieran O Leary kieran.o.leary at gmail.com
Tue May 5 14:50:55 EEST 2020


Hi Neil,

I have to look deeper into the MKV side of things and most likely raise it
with the cellar mailing list so that better minds than mine can weigh in. I
do see that the rounding up to 704 could be an issue alright.
As for MOV, your patch appears to generate the same output clap values as
the input, so that's really great! command line and mediainfo trace below:
$ ./ffmpeg -i /mnt/c/Users/blaaa/Downloads/clap.mov -c:v v210 newv210.mov
&& mediainfo --Details=1 newv210.mov |grep -i clap -n10
ffmpeg version N-97506-g2fae000994 Copyright (c) 2000-2020 the FFmpeg
developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration:
  libavutil      56. 43.100 / 56. 43.100
  libavcodec     58. 82.100 / 58. 82.100
  libavformat    58. 42.101 / 58. 42.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 79.100 /  7. 79.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/mnt/c/Users/blaaa/Downloads/clap.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2018-09-13T08:48:41.000000Z
  Duration: 00:00:01.00, start: 0.000000, bitrate: 80686 kb/s
    Stream #0:0(eng): Video: v210 (v210 / 0x30313276),
yuv422p10le(smpte170m/bt470bg/bt709, top coded first (swapped)), 720x576,
79626 kb/s, SAR 59:54 DAR 295:216, 9 fps, 25 tbr, 25k tbn, 25k tbc (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : ?Apple Video Media Handler
      encoder         : Uncompressed 10-Bit YUV
      timecode        : 00:00:00:00
    Side data:
      Clean aperture:[width 41472/59 height:576/1 h_offset:0/1 v_offset:0/1]
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz,
stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : ?Apple Sound Media Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : Time Code Media Handler
      reel_name       : 001
      timecode        : 00:00:00:00
File 'newv210.mov' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (v210 (native) -> v210 (native))
  Stream #0:1 -> #0:1 (pcm_s24le (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'newv210.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    encoder         : Lavf58.42.101
    Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le(top
coded first (swapped)), 720x576 [SAR 59:54 DAR 295:216], q=2-31, 221184
kb/s, 0.04 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : ?Apple Video Media Handler
      timecode        : 00:00:00:00
      encoder         : Lavc58.82.100 v210
    Side data:
      Clean aperture:[width 41472/59 height:576/1 h_offset:0/1 v_offset:0/1]
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp (24 bit), 128 kb/s (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : ?Apple Sound Media Handler
      timecode        : 00:00:00:00
      encoder         : Lavc58.82.100 aac
frame=   25 fps=0.0 q=-0.0 Lsize=   27009kB time=00:00:00.96
bitrate=230455.2kbits/s dup=16 drop=0 speed=19.8x
video:27000kB audio:6kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.008794%
[aac @ 0x7fffe91cc680] Qavg: 171.537
226-1A5FBA4         detail:                         9 (0x09)
227-1A5FBA5        Pixel Aspect Ratio (16 bytes)
228-1A5FBA5         Header (8 bytes)
229-1A5FBA5          Size:                          16 (0x00000010)
230-1A5FBA9          Name:                          pasp
231-1A5FBAD         hSpacing:                       59 (0x0000003B)
232-1A5FBB1         vSpacing:                       54 (0x00000036)
233-1A5FBB5        Clean Aperture (40 bytes)
234-1A5FBB5         Header (8 bytes)
235-1A5FBB5          Size:                          40 (0x00000028)
236:1A5FBB9          Name:                          clap
237-1A5FBBD         apertureWidth_N:                41472 (0x0000A200)
238-1A5FBC1         apertureWidth_D:                59 (0x0000003B)
239-1A5FBC5         apertureHeight_N:               576 (0x00000240)
240-1A5FBC9         apertureHeight_D:               1 (0x00000001)
241-1A5FBCD         horizOff_N:                     0 (0x00000000)
242-1A5FBD1         horizOff_D:                     1 (0x00000001)
243-1A5FBD5         vertOff_N:                      0 (0x00000000)
244-1A5FBD9         vertOff_D:                      1 (0x00000001)
245-1A5FBDD      Time to Sample (24 bytes)
246-1A5FBDD       Header (8 bytes)


and here's similar info for mkv:

 ./ffmpeg -i /mnt/c/Users/blaaa/Downloads/clap.mov -c:v v210 newv210.mkv &&
m
ediainfo --Details=1 newv210.mkv |grep -i pixel -n10
ffmpeg version N-97506-g2fae000994 Copyright (c) 2000-2020 the FFmpeg
developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration:
  libavutil      56. 43.100 / 56. 43.100
  libavcodec     58. 82.100 / 58. 82.100
  libavformat    58. 42.101 / 58. 42.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 79.100 /  7. 79.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/mnt/c/Users/blaaa/Downloads/clap.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2018-09-13T08:48:41.000000Z
  Duration: 00:00:01.00, start: 0.000000, bitrate: 80686 kb/s
    Stream #0:0(eng): Video: v210 (v210 / 0x30313276),
yuv422p10le(smpte170m/bt470bg/bt709, top coded first (swapped)), 720x576,
79626 kb/s, SAR 59:54 DAR 295:216, 9 fps, 25 tbr, 25k tbn, 25k tbc (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : ?Apple Video Media Handler
      encoder         : Uncompressed 10-Bit YUV
      timecode        : 00:00:00:00
    Side data:
      Clean aperture:[width 41472/59 height:576/1 h_offset:0/1 v_offset:0/1]
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz,
stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : ?Apple Sound Media Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : Time Code Media Handler
      reel_name       : 001
      timecode        : 00:00:00:00
File 'newv210.mkv' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (v210 (native) -> v210 (native))
  Stream #0:1 -> #0:1 (pcm_s24le (native) -> ac3 (native))
Press [q] to stop, [?] for help
Output #0, matroska, to 'newv210.mkv':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    encoder         : Lavf58.42.101
    Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le(top
coded first (swapped)), 720x576 [SAR 59:54 DAR 295:216], q=2-31, 221184
kb/s, 25 fps, 1k tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : ?Apple Video Media Handler
      timecode        : 00:00:00:00
      encoder         : Lavc58.82.100 v210
    Side data:
      Clean aperture:[width 41472/59 height:576/1 h_offset:0/1 v_offset:0/1]
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo,
fltp (24 bit), 192 kb/s (default)
    Metadata:
      creation_time   : 2018-09-13T08:48:41.000000Z
      handler_name    : ?Apple Sound Media Handler
      timecode        : 00:00:00:00
      encoder         : Lavc58.82.100 ac3
frame=    9 fps=0.0 q=-0.0 Lsize=    9731kB time=00:00:00.41
bitrate=193962.2kbits/s speed=10.6x
video:9720kB audio:10kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.015487%
193-000144     Data:                               40000000 (0x02625A00)
194-000148    CodecID - V_MS/VFW/FOURCC (17 bytes)
195-000148     Header (2 bytes)
196-000148      Name:                              6 (0x06)
197-000149      Size:                              15 (0x0F)
198-00014A     Data:                               V_MS/VFW/FOURCC
199-000159    Video (52 bytes)
200-000159     Header (9 bytes)
201-000159      Name:                              96 (0x60)
202-00015A      Size:                              43 (0x0000000000002B)
203:000162     PixelWidth - 720 (0x2D0) (4 bytes)
204-000162      Header (2 bytes)
205-000162       Name:                             48 (0x30)
206-000163       Size:                             2 (0x02)
207-000164      Data:                              720 (0x02D0)
208:000166     PixelHeight - 576 (0x240) (4 bytes)
209-000166      Header (2 bytes)
210-000166       Name:                             58 (0x3A)
211-000167       Size:                             2 (0x02)
212-000168      Data:                              576 (0x0240)
213-00016A     FlagInterlaced - 1 (0x1) (3 bytes)
214-00016A      Header (2 bytes)
215-00016A       Name:                             26 (0x1A)
216-00016B       Size:                             1 (0x01)
217-00016C      Data:                              1 (0x01)
218-00016D     FieldOrder - 9 (0x9) (3 bytes)
--
228-000175     DisplayHeight - 216 (0xD8) (4 bytes)
229-000175      Header (3 bytes)
230-000175       Name:                             5306 (0x14BA)
231-000177       Size:                             1 (0x01)
232-000178      Data:                              216 (0xD8)
233-000179     DisplayUnit - 3 (0x3) (4 bytes)
234-000179      Header (3 bytes)
235-000179       Name:                             5298 (0x14B2)
236-00017B       Size:                             1 (0x01)
237-00017C      Data:                              3 (0x03)
238:00017D     PixelCropLeft - 8 (0x8) (4 bytes)
239-00017D      Header (3 bytes)
240-00017D       Name:                             5324 (0x14CC)
241-00017F       Size:                             1 (0x01)
242-000180      Data:                              8 (0x08)
243:000181     PixelCropRight - 8 (0x8) (4 bytes)
244-000181      Header (3 bytes)
245-000181       Name:                             5341 (0x14DD)
246-000183       Size:                             1 (0x01)
247-000184      Data:                              8 (0x08)
248:000185     PixelCropBottom - 0 (0x0) (4 bytes)
249-000185      Header (3 bytes)
250-000185       Name:                             5290 (0x14AA)
251-000187       Size:                             1 (0x01)
252-000188      Data:                              0 (0x00)
253:000189     PixelCropTop - 0 (0x0) (4 bytes)
254-000189      Header (3 bytes)
255-000189       Name:                             5307 (0x14BB)
256-00018B       Size:                             1 (0x01)
257-00018C      Data:                              0 (0x00)
258-00018D    CodecPrivate - Copy of vids (43 bytes)
259-00018D     Header (3 bytes)
260-00018D      Name:                              9122 (0x23A2)
261-00018F      Size:                              40 (0x28)
262-000190     Size:                               40 (0x00000028)
263-000194     Width:                              720 (0x000002D0)

Best,

Kieran O'Leary
Irish Film Institute


More information about the ffmpeg-devel mailing list