[FFmpeg-user] Why are half the frames "duplicate" ?
sean darcy
seandarcy2 at gmail.com
Tue Oct 2 04:26:02 EEST 2018
On 9/30/18 2:58 PM, Carl Eugen Hoyos wrote:
> 2018-09-30 17:21 GMT+02:00, sean darcy <seandarcy2 at gmail.com>:
>> On 9/30/18 10:45 AM, sean darcy wrote:
>>> On 9/29/18 5:15 PM, Carl Eugen Hoyos wrote:
>>>> 2018-09-29 22:46 GMT+02:00, sean darcy <seandarcy2 at gmail.com>:
>>>>> On 9/28/18 7:29 PM, Carl Eugen Hoyos wrote:
>>>>>> 2018-09-28 20:58 GMT+02:00, sean darcy <seandarcy2 at gmail.com>:
>>>>>>
>>>>>>> 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
>>>>>>
>>>>>> No, unfortunately ffprobe cannot tell you (the information above
>>>>>> is mostly unrelated to the question if the content is interlaced,
>>>>>> telecined or progressive).
>>>>>>
>>>>>> Either use the idet filter or do a visual inspection.
>>>>>>
>>>>>> Carl Eugen
>>>>>> _______________________________________________
>>>>>
>>>>> Never used idet filter before, so don't know how to make use of the
>>>>> info.
>>>>>
>>>>> ffmpeg -vf idet -frames:v 5000 -an -f rawvideo -y /dev/null -i in.mpg
>>>>> 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 @ 0x1eef200] 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
>>>>> Stream mapping:
>>>>> Stream #0:0 -> #0:0 (mpeg2video (native) -> rawvideo (native))
>>>>> Press [q] to stop, [?] for help
>>>>> Output #0, rawvideo, to '/dev/null':
>>>>> Metadata:
>>>>> encoder : Lavf58.18.103
>>>>> Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480
>>>>> [SAR 8:9 DAR 4:3], q=2-31, 124291 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
>>>>> Metadata:
>>>>> encoder : Lavc58.31.101 rawvideo
>>>>> More than 1000 frames duplicated= 2191360kB time=00:02:24.44
>>>>> bitrate=124280.6kbits/s dup=867 drop=0 speed=72.2x
>>>>> frame= 5000 fps=2162 q=-0.0 Lsize= 2531250kB time=00:02:46.83
>>>>> bitrate=124291.7kbits/s dup=1001 drop=0 speed=72.1x
>>>>> video:2531250kB audio:0kB subtitle:0kB other streams:0kB global
>>>>> headers:0kB muxing overhead: 0.000000%
>>>>> [Parsed_idet_0 @ 0x21f7dc0] Repeated Fields: Neither: 4000 Top: 0
>>>>> Bottom: 0
>>>>> [Parsed_idet_0 @ 0x21f7dc0] Single frame detection: TFF: 0 BFF:
>>>>> 0 Progressive: 3894 Undetermined: 106
>>>>> [Parsed_idet_0 @ 0x21f7dc0] Multi frame detection: TFF: 0 BFF: 0
>>>>> Progressive: 4000 Undetermined: 0
>>>>>
>>>>> As I read this, the idet filter only saw 4000 out of the 5000 frames, of
>>>>> which 106 couldn't be classified. What about the 1001 duplicated
>>>>> frames ?
>>>>
>>>> This indicates soft-telecine of progressive original.
>>>>
>>>> Please test with output option "-r 24000/1001". If that
>>>> leads to (many) duplicated and dropped frames, there
>>>> are ways to work-around iirc.
>>>>
>>>> Carl Eugen
>>>
>>> You are the man !
>>>
>>> Ran the entire clip at 24000/1001, only 11 duplicated frames.
>
> This imo indicates that the command line is correct.
>
>>> What did you see in the idet output that told you that the progressive
>>> original (~24fps, correct ? ) had been telecined ?
>
> I saw that it was not telecined (since all frames are progressive).
> Therefore the only explanation that made sense was soft-telecine:
> The actual framerate was always 24000/1001 but since old American
> televisions required 30000/1001, the stream contains information
> that frames have to be duplicated (what FFmpeg did originally).
>
> Maybe unrelated:
> Note that FFmpeg's mpeg-ps muxer is unable to add this information
> to its output streams, MEncoder can do it.
>
Thanks. Very helpful.
>> I've been googling soft telecine. Some have suggested using "-re"
>> as the frame rate. Why would 24000/1001 be preferred ?
>
> That does not sound correct, "-re" allows FFmpeg to encode in
> real-time (instead of faster), it should not change the output frame
> rate. Does it?
>
> Carl Eugen
From 12 years ago:
https://lists.libav.org/pipermail/ffmpeg-user/2006-February/002349.html
make an decoding/encoding with
framerate " -re" (instead of "-r pal" or -r ntsc" or "-r 25" or "-r
30000:1001", ...) the "-re" parameter for framerate will just
decode/encode your input without forcing framerate (read your input at
its own framerate and write it "the same")
You'll will see (even if your input was a ntsc-film with pulldown)
that your output will be 24000:1001 too.
More information about the ffmpeg-user
mailing list