[FFmpeg-user] Questions about w3fdif deinterlacing

Christian Ebert blacktrash at gmx.net
Sun Jan 19 17:38:13 CET 2014


* Andy Furniss on Sunday, January 19, 2014 at 11:48:08 +0000
> "hardware encoder set to interlaced" does not mean a single global
> flag - it's on every frame whether it's interlaced or not, this is the
> general rule for DVB broadcast.
> 
> Of course there are exceptions that prove rules :-)
> 
> 67 meg indirect link
> 
> http://www.datafilehost.com/d/1293ad4e

Thanks for the sample.

> I post this because it lets you answer your questions by black box testing.

See below.

> Some tests on my mixed stream with yadif=1 which like w3fdif will make
> 50fps from 25i but in this test sometimes only on some frames.
> 
> analyse sample with ffprobe -
> 
> how many frames -
> 
> ffprobe -show_frames prog-int.ts 2>/dev/null | grep video | wc -l
> 
> 1164
> 
> what are the flags (on older ffprobe it was -A 17)
> 
> ffprobe -show_frames  prog-int.ts 2>/dev/null | grep video -A 19 |
> grep interlac | uniq -c
> 
>    404 interlaced_frame=0
>    760 interlaced_frame=1
> 
> How many frames with -
> 
> ffmpeg -i prog-int.ts -vf yadif=1:deint=interlaced -f null /dev/null
> <snip>
> frame= 1924 fps=129 q=0.0 Lsize=N/A time=00:00:47.66 bitrate=N/A
> 
> seems right -
> 
> echo $[404+760+760]
> 1924
> 
> Test -vf idet,yadif=1
> 
> From this thread we already know this will correct parity - although
> the sample provided was 100% detected correctly.
> 
> I don't know what would happen if the detection was less clear (but
> then I suppose you may not notice even if the parity was wrong on
> still frame runs)
> 
> ffmpeg -i prog-int.ts -vf idet,yadif=1 -f null /dev/null
> 
> frame= 2326 fps= 58 q=0.0 Lsize=N/A time=00:00:47.50 bitrate=N/A
> 
> [Parsed_idet_0 @ 0x2446580] Single frame detection: TFF:599 BFF:0
> Progressive:444 Undetermined:120
> [Parsed_idet_0 @ 0x2446580] Multi frame detection: TFF:689 BFF:0
> Progressive:474 Undetermined:0
> 
> echo $[1164+1164]
> 2328
> 
> so apart from a 2 frame diff looks like all are deinterlaced and the
> detection does well but different (it may be more accurate than the
> flags WRT screen content for this sample)
> 
> next test -vf idet,yadif=1:deint=interlaced
> 
> ffmpeg -i prog-int.ts -vf idet,yadif=1:deint=interlaced -f null /dev/null
> 
> frame= 1852 fps= 54 q=0.0 Lsize=N/A time=00:00:47.50 bitrate=N/A
> 
> [Parsed_idet_0 @ 0x2946480] Single frame detection: TFF:599 BFF:0
> Progressive:444 Undetermined:120
> [Parsed_idet_0 @ 0x2946480] Multi frame detection: TFF:689 BFF:0
> Progressive:474 Undetermined:0
> 
> echo $[474+689+689]
> 1852
> 
> So it looks like idet does control the result here.

I seem to get different results regarding the amount of resulting
frames:

ffmpeg -y -v quiet -i prog-int.ts -an -vf yadif=1 test.mp4
ffprobe -show_frames test.mp4 2>/dev/null | grep -c video
2356
ffmpeg -y -v quiet -i prog-int.ts -an -vf yadif=1:deint=interlaced test.mp4
ffprobe -show_frames test.mp4 2>/dev/null | grep -c video
2356
ffmpeg -y -v quiet -i prog-int.ts -an -vf idet,yadif=1 test.mp4
ffprobe -show_frames test.mp4 2>/dev/null | grep -c video
2348
ffmpeg -y -v quiet -i prog-int.ts -an -vf idet,yadif=1:deint=interlaced test.mp4
ffprobe -show_frames test.mp4 2>/dev/null | grep -c video
2348

And I don't understand why deinterlacing takes place in the
following case:

ffmpeg -i test.vob -vf idet -f null /dev/null
ffmpeg version N-59397-g8efde6d Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 28 2013 16:26:41 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-network --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 46.100 / 55. 46.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.2 : stereo
Input #0, mpeg, from 'test.vob':
  Duration: 00:00:49.27, start: 0.360000, bitrate: 5521 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 16:15 DAR 4:3], max. 7000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0xa0]: Audio: pcm_dvd, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf55.22.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video -> rawvideo)
  Stream #0:2 -> #0:1 (pcm_dvd -> pcm_s16le)
Press [q] to stop, [?] for help
[null @ 0x7f9c2382ae00] Encoder did not produce proper pts, making some up.
frame= 1231 fps=343 q=0.0 Lsize=N/A time=00:00:49.28 bitrate=N/A
video:115kB audio:9240kB subtitle:0 global headers:0kB muxing overhead -100.000230%
[Parsed_idet_0 @ 0x7f9c24000000] Single frame detection: TFF:0 BFF:0 Progressive:928 Undetermined:303
[Parsed_idet_0 @ 0x7f9c24000000] Multi frame detection: TFF:0 BFF:0 Progressive:1210 Undetermined:21
ffprobe -select_streams v -show_frames test.vob 2>/dev/null | grep -c video
1232
ffmpeg -y -v quiet -i test.vob -vf idet,yadif=1 test.mp4
ffprobe -select_streams v -show_frames test.mp4 2>/dev/null | grep -c video
2462

As idet does not report any interlaced frames, why are nearly all
frames deinterlaced?

I must be misunderstanding something entirely, sorry for being
naïve.

-- 
\black\trash movie         _SAME  TIME  SAME  PLACE_
 --->> http://www.blacktrash.org/underdogma/stsp.php
\black\trash audio   _ANOTHER  TIME  ANOTHER  PLACE_
--->> http://www.blacktrash.org/underdogma/atap.html


More information about the ffmpeg-user mailing list