[FFmpeg-user] DV to H.264: correct interlacing metadata?

Peter B. pb at das-werkstatt.com
Tue May 7 00:57:04 EEST 2019


Hello everyone :)

I'm trying to create different encoding/wrapper combinations for a DV
source material (PAL, interlaced, BFF).

When I convert it to H.264 in MP4, the "scan type/scan order"
information seems to get lost if untreated, or reverts to TFF even if it
says "bottom coded first (swapped)" during generating the H.264 copy.
Strangely though, this tech-MD is perfectly transferred when I convert
to FFV1 in MKV?

Command I've used:
$ ffmpeg-rel -i "original.dv" -c:a aac -b:a 192k -c:v libx264 -crf 10
-map 0 "out/mezz/h264.mp4"
(Output: see further below)

Mediainfo on the source says:
  * Scan type                                : Interlaced
  * Scan order                               : Bottom Field First

Mediainfo on the target says:
  * Scan type                                : Progressive

Ok, so I added good-old "-flags +ildct -top 0":

But Mediainfo now of the target file says it's "TFF", while encoder job
said BFF (see output further below):
  * Scan type                                : MBAFF
  * Scan type, store method                  : Interleaved fields
  * Scan order                               : Top Field First

And this tech-MD seems to get even lost when transcoding then again to
FFV1 in MKV.

----------------------------------------------------
Is that behavior intended, and if so:
Could anyone help me how I can correctly encode DV to H.264 in MP4?
----------------------------------------------------


Thank you very much in advance,
Peter



Command and complete, uncut console output:
===============================

$ ffmpeg -i "original.dv" -c:a aac -b:a 192k -c:v libx264 -crf 10 -flags
+ildct -top 0 -map 0 "out/mezz/h264.mp4"


ffmpeg version 4.0.1-static https://johnvansickle.com/ffmpeg/  Copyright
(c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gray --enable-libaom --enable-libfribidi
--enable-libass --enable-libvmaf --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband
--enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus
--enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
--enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
[dv @ 0x6049cc0] Estimating duration from bitrate, this may be inaccurate
Input #0, dv, from 'original.dv':
  Metadata:
    timecode        : 00:00:00:02
  Duration: 00:00:27.16, start: 0.000000, bitrate: 28800 kb/s
    Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3],
25000 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'out/mezz/original.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (dvvideo (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x6050f40] interlace + weightp is not implemented
[libx264 @ 0x6050f40] using SAR=16/15
[libx264 @ 0x6050f40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x6050f40] profile High, level 3.0
[libx264 @ 0x6050f40] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html -
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
interlaced=tff bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=0 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=1 crf=10.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
Output #0, mp4, to 'out/mezz/original.mp4':
  Metadata:
    timecode        : 00:00:00:02
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661),
yuv420p(bottom coded first (swapped)), 720x576 [SAR 16:15 DAR 4:3],
q=-1--1, 0.04 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 192 kb/s
    Metadata:
      encoder         : Lavc58.18.100 aac
[dvvideo @ 0x604d5c0] Concealing bitstream errors0:00:26.26
bitrate=22919.0kbits/s speed=1.96x   
    Last message repeated 323 times
frame=  679 fps= 46 q=-1.0 Lsize=   82682kB time=00:00:27.17
bitrate=24921.3kbits/s speed=1.83x   
video:82021kB audio:638kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.026222%
[libx264 @ 0x6050f40] frame I:6     Avg QP:10.94  size:135986
[libx264 @ 0x6050f40] frame P:270   Avg QP:13.47  size:122927
[libx264 @ 0x6050f40] frame B:403   Avg QP:14.34  size:124027
[libx264 @ 0x6050f40] consecutive B-frames: 20.5%  0.9%  0.9% 77.8%
[libx264 @ 0x6050f40] mb I  I16..4:  0.0% 98.5%  1.5%
[libx264 @ 0x6050f40] mb P  I16..4:  2.1% 89.6%  1.1%  P16..4:  1.7% 
3.1%  2.5%  0.0%  0.0%    skip: 0.0%
[libx264 @ 0x6050f40] mb B  I16..4:  0.4% 62.6%  0.9%  B16..8: 10.4%
13.4%  5.7%  direct: 6.6%  skip: 0.1%  L0:14.7% L1: 8.7% BI:76.7%
[libx264 @ 0x6050f40] field mbs: intra: 4.7% inter:1.0% skip:0.0%
[libx264 @ 0x6050f40] 8x8 transform intra:97.3% inter:98.0%
[libx264 @ 0x6050f40] coded y,uvDC,uvAC intra: 100.0% 67.5% 33.6% inter:
99.5% 68.9% 23.6%
[libx264 @ 0x6050f40] i16 v,h,dc,p:  0%  0% 86% 13%
[libx264 @ 0x6050f40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8%  6% 63%  5% 
3%  4%  3%  4%  4%
[libx264 @ 0x6050f40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7%  8% 29% 11%  9%
10%  8%  9%  9%
[libx264 @ 0x6050f40] i8c dc,h,v,p: 41% 25% 26%  8%
[libx264 @ 0x6050f40] ref P L0: 43.4% 30.4% 25.9%  0.1%  0.1%  0.1%
[libx264 @ 0x6050f40] ref B L0: 67.3% 24.4%  8.2%  0.1%  0.0%  0.0%
[libx264 @ 0x6050f40] ref B L1: 85.3% 14.6%  0.1%  0.0%
[libx264 @ 0x6050f40] kb/s:24739.11
[aac @ 0x60522c0] Qavg: 247.065



More information about the ffmpeg-user mailing list