[FFmpeg-user] Why are half the frames "duplicate" ?

sean darcy seandarcy2 at gmail.com
Fri Sep 28 21:58:45 EEST 2018


On 9/27/18 5:11 PM, Carl Eugen Hoyos wrote:
> 2018-09-27 4:27 GMT+02:00, sean darcy <seandarcy2 at gmail.com>:
>> I'm transcoding mpeg2 -> x264.
>>
>> Stream #0:0[0x64]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
>> yuv420p(tv, progressive), 720x480 [SAR 8:9 DAR 4:3], Closed Captions,
>> 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
>>
>> When I run ffmpeg:
>>
>> ffmpeg -i in.mpg -map 0:0 -map 0:2 -c:v libx264 -tune film -preset slow
>> -crf 22 -c:a copy out.mp4
> 
> Please (test current FFmpeg git head and) provide the command line
> you used together with the complete, uncut console output.
> 
> If your input is progressive and variable frame rate and you want
> mp4 output, then the duplicated frames are unavoidable as FFmpeg
> is unable to write valid variable frame rate mp4 files.
> (vfr mkv is supported)
> If your input is mixed telecined and progressive, there are command
> lines that help iirc.
> If your input is only telecined or soft telecined, the output frame-rate
> should be 24000/1001 (this is also true for the case above).
> The idet filter can help you detect what your input's properties are,
> visual inspection is even better, an alternative is to provide a sample.
> 
> Carl Eugen
> _______________________________________________

Thanks for the help.

  ffmpeg -i in.mpg -frames:v 2000 -map 0:0 -map 0:2 -c:v libx264 -tune 
film -preset slow -crf 22 -an -f mp4 /dev/null
ffmpeg version git-snapshot-20180928-RPMFusion Copyright (c) 2000-2018 
the FFmpeg developers
   built with gcc 8 (GCC)
   configuration: --prefix=/usr --bindir=/usr/bin 
--datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg 
--libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 
--optflags='-O2 -ffast-math -march=native -ftree-vectorize 
-fomit-frame-pointer -pipe -fPIC' --enable-bzlib --disable-crystalhd 
--enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls 
--enable-ladspa --enable-libass --enable-libbluray --enable-libcdio 
--enable-libfdk-aac --enable-nonfree --enable-indev=jack 
--enable-libfreetype --enable-libfribidi --enable-libgsm 
--enable-libmp3lame --enable-openal --enable-opencl --disable-libopencv 
--enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse 
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis 
--enable-libv4l2 --enable-libvpx --enable-libwebp --enable-libx264 
--enable-libx265 --enable-avfilter --enable-postproc --enable-pthreads 
--disable-static --enable-shared --enable-gpl --enable-version3 
--enable-nonfree --disable-debug --enable-stripping 
--shlibdir=/usr/lib64 --enable-runtime-cpudetect
   libavutil      56. 19.101 / 56. 19.101
   libavcodec     58. 31.101 / 58. 31.101
   libavformat    58. 18.103 / 58. 18.103
   libavdevice    58.  4.104 / 58.  4.104
   libavfilter     7. 33.100 /  7. 33.100
   libswscale      5.  2.100 /  5.  2.100
   libswresample   3.  2.100 /  3.  2.100
   libpostproc    55.  2.100 / 55.  2.100
[mpeg2video @ 0xe34a00] Invalid frame dimensions 0x0.
     Last message repeated 10 times
Input #0, mpeg, from 'in.mpg':
   Duration: 26:09:34.50, start: 1305.384367, bitrate: 91 kb/s
     Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, 
progressive), 720x480 [SAR 8:9 DAR 4:3], Closed Captions, 29.97 fps, 
59.94 tbr, 90k tbn, 59.94 tbc
     Stream #0:1[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
     Stream #0:2[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
     Stream #0:3[0x1bf]: Data: dvd_nav_packet
     Stream #0:4[0x22]: Subtitle: dvd_subtitle
     Stream #0:5[0x21]: Subtitle: dvd_subtitle
     Stream #0:6[0x20]: Subtitle: dvd_subtitle
File '/dev/null' already exists. Overwrite ? [y/N] y
Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0xe5b180] using SAR=8/9
[libx264 @ 0xe5b180] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 
AVX FMA3 BMI2 AVX2
[libx264 @ 0xe5b180] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0xe5b180] 264 - core 157 - H.264/MPEG-4 AVC codec - Copyleft 
2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 
deblock=1:-1:-1 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.15 
mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 
deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=12 
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 
b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf 
mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 
aq=1:1.00
Output #0, mp4, to '/dev/null':
   Metadata:
     encoder         : Lavf58.18.103
     Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 
720x480 [SAR 8:9 DAR 4:3], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
     Metadata:
       encoder         : Lavc58.31.101 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 2000 fps=132 q=-1.0 Lsize=   10708kB time=00:01:06.63 
bitrate=1316.5kbits/s dup=401 drop=0 speed=4.39x
video:10684kB audio:0kB subtitle:0kB other streams:0kB global 
headers:0kB muxing overhead: 0.229348%
[libx264 @ 0xe5b180] frame I:10    Avg QP:21.04  size: 33873
[libx264 @ 0xe5b180] frame P:593   Avg QP:23.63  size: 12243
[libx264 @ 0xe5b180] frame B:1397  Avg QP:25.67  size:  2391
[libx264 @ 0xe5b180] consecutive B-frames:  0.6% 18.5%  1.4% 79.6%
[libx264 @ 0xe5b180] mb I  I16..4:  2.8% 90.7%  6.5%
[libx264 @ 0xe5b180] mb P  I16..4:  0.5% 10.7%  0.7%  P16..4: 47.9% 
21.4% 10.1%  0.0%  0.0%    skip: 8.7%
[libx264 @ 0xe5b180] mb B  I16..4:  0.0%  0.5%  0.0%  B16..8: 35.4% 
5.2%  1.1%  direct: 2.1%  skip:55.6%  L0:45.0% L1:42.4% BI:12.6%
[libx264 @ 0xe5b180] 8x8 transform intra:90.0% inter:76.7%
[libx264 @ 0xe5b180] direct mvs  spatial:99.6% temporal:0.4%
[libx264 @ 0xe5b180] coded y,uvDC,uvAC intra: 88.7% 74.2% 28.5% inter: 
17.7% 23.4% 1.0%
[libx264 @ 0xe5b180] i16 v,h,dc,p: 47% 12%  9% 32%
[libx264 @ 0xe5b180] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 10% 13%  7% 10% 
12% 10% 11% 10%
[libx264 @ 0xe5b180] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17%  6%  3%  8% 15% 
17% 13% 11%  9%
[libx264 @ 0xe5b180] i8c dc,h,v,p: 39% 24% 25% 12%
[libx264 @ 0xe5b180] Weighted P-Frames: Y:17.7% UV:13.0%
[libx264 @ 0xe5b180] ref P L0: 52.3% 18.7% 17.0%  6.0%  5.0%  1.0%
[libx264 @ 0xe5b180] ref B L0: 89.7%  7.1%  2.7%  0.6%
[libx264 @ 0xe5b180] ref B L1: 99.5%  0.5%
[libx264 @ 0xe5b180] kb/s:1311.43

Also, I used ffprobe:

ffprobe -show_frames -select_streams v -i in.mpg  2>&1 | grep -c 
interlaced_frame=1
2052
ffprobe -show_frames -select_streams v -i in.mpg  2>&1 | grep -c 
interlaced_frame=0
30347

This means there are at least some interlaced frames. Is yadif called for ?

And the frames have two different durations:

ffprobe -show_frames -select_streams v -i in.mpg  2>&1 | grep -c 
pkt_duration_time
32399

ffprobe -show_frames -select_streams v -i in.mpg  2>&1 | grep -c 
pkt_duration_time=0.033367
17227

ffprobe -show_frames -select_streams v -i in.mpg  2>&1 | grep -c 
pkt_duration_time=0.050044
15172

which generally alternate.



More information about the ffmpeg-user mailing list