#6577: mkv vs encoding interlacement mismatch
-------------------------------------+-------------------------------------
               Reporter:  dericed    |                  Owner:
                   Type:  defect     |                 Status:  new
               Priority:  normal     |              Component:
                Version:  git-       |  undetermined
  master                             |               Keywords:  matroska
             Blocked By:             |               Blocking:
Reproduced by developer:  0          |  Analyzed by developer:  0
-------------------------------------+-------------------------------------
 Summary of the bug:

 The interlacement data between an encoded ffv1 stream and the mkv
 container appear to contradict each other.

 How to reproduce:

 Created an interlaced ffv1 mkv file.
 {{{
 ffmpeg -f lavfi -i mandelbrot -vf setfield=tff -vframes 1 -c:v ffv1 -y
 test.mkv
 ffmpeg version N-48208-gdf884e038f Copyright (c) 2000-2017 the FFmpeg
 developers
   built with Apple LLVM version 8.1.0 (clang-802.0.38)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-df884e0 --enable-
 shared --enable-pthreads --enable-gpl --enable-version3 --enable-
 hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-
 ldflags= --enable-ffplay --enable-libfreetype --enable-libmp3lame
 --enable-libopus --enable-libtesseract --enable-libvpx --enable-libx264
 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
   libavutil      55. 72.100 / 55. 72.100
   libavcodec     57.102.100 / 57.102.100
   libavformat    57. 76.100 / 57. 76.100
   libavdevice    57.  7.100 / 57.  7.100
   libavfilter     6. 98.100 /  6. 98.100
   libavresample   3.  6.  0 /  3.  6.  0
   libswscale      4.  7.102 /  4.  7.102
   libswresample   2.  8.100 /  2.  8.100
   libpostproc    54.  6.100 / 54.  6.100
 Input #0, lavfi, from 'mandelbrot':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (RGB[0] / 0x424752), rgb0, 640x480 [SAR
 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> ffv1 (native))
 Press [q] to stop, [?] for help
 Output #0, matroska, to 'test.mkv':
   Metadata:
     encoder         : Lavf57.76.100
     Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), bgr0, 640x480 [SAR 1:1
 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
     Metadata:
       encoder         : Lavc57.102.100 ffv1
 frame=    1 fps=0.0 q=-0.0 Lsize=     212kB time=00:00:00.00
 bitrate=1739832.0kbits/s speed=0.0198x
 video:212kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.362262%
 }}}

 Check Matroska interlacement in Tracks/Video/FieldOrder with mkvinfo

 {{{
  mkvinfo test.mkv | grep "Field order"
 |   + Field order: 9 (bottom field displayed first, top field stored
 first)
 }}}

 Check FFV1 interlacement with ffprobe:

 {{{
 ffprobe test.mkv -show_entries frame=interlaced_frame,top_field_first
 ffprobe version N-48208-gdf884e038f Copyright (c) 2007-2017 the FFmpeg
 developers
   built with Apple LLVM version 8.1.0 (clang-802.0.38)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-df884e0 --enable-
 shared --enable-pthreads --enable-gpl --enable-version3 --enable-
 hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-
 ldflags= --enable-ffplay --enable-libfreetype --enable-libmp3lame
 --enable-libopus --enable-libtesseract --enable-libvpx --enable-libx264
 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
   libavutil      55. 72.100 / 55. 72.100
   libavcodec     57.102.100 / 57.102.100
   libavformat    57. 76.100 / 57. 76.100
   libavdevice    57.  7.100 / 57.  7.100
   libavfilter     6. 98.100 /  6. 98.100
   libavresample   3.  6.  0 /  3.  6.  0
   libswscale      4.  7.102 /  4.  7.102
   libswresample   2.  8.100 /  2.  8.100
   libpostproc    54.  6.100 / 54.  6.100
 Input #0, matroska,webm, from 'test.mkv':
   Metadata:
     ENCODER         : Lavf57.76.100
   Duration: 00:00:00.04, start: 0.000000, bitrate: 43495 kb/s
     Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), bgr0(top coded first
 (swapped)), 640x480, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn, 1k tbc
 (default)
     Metadata:
       ENCODER         : Lavc57.102.100 ffv1
       DURATION        : 00:00:00.040000000
 [FRAME]
 interlaced_frame=1
 top_field_first=1
 [/FRAME]
 }}}

 The Matroska seems to say `bottom field displayed first, top field stored
 first`
 FFV1 seems to say `top_field_first=1` which IIUC means `top field
 displayed first`. Am I understanding this wrong or is ffmpeg writing the
 wrong value in Matroska here?

 Patches should be submitted to the ffmpeg-devel mailing list and not this
 bug tracker.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6577>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-trac

Reply via email to