Jump to content

Interlaced video detection


Recommended Posts

sfatula
Posted (edited)

Been seeing this fail more recently. Isn't it possible to mix interlaced video with non interlaced? ffprobe is saying the video is not interlaced. Running this command:

 

ffmpeg -filter:v idet -frames:v 100 -an -f rawvideo -y /dev/null -i 'KTEN News at 10 2020_03_30_22_00_00.ts'

 

Results in:

 

[Parsed_idet_0 @ 0x557b32e66ac0] Repeated Fields: Neither:    59 Top:     0 Bottom:     0
[Parsed_idet_0 @ 0x557b32e66ac0] Single frame detection: TFF:     0 BFF:     2 Progressive:    57 Undetermined:     0
[Parsed_idet_0 @ 0x557b32e66ac0] Multi frame detection: TFF:     0 BFF:     0 Progressive:    59 Undetermined:     0
 
Changing to 1000 frames:
 
ffmpeg -filter:v idet -frames:v 1000 -an -f rawvideo -y /dev/null -i 'KTEN News at 10 2020_03_30_22_00_00.ts'
 
Results in:
 
[Parsed_idet_0 @ 0x56365e554ac0] Repeated Fields: Neither:   754 Top:    28 Bottom:    25
[Parsed_idet_0 @ 0x56365e554ac0] Single frame detection: TFF:   123 BFF:    25 Progressive:   572 Undetermined:    87
[Parsed_idet_0 @ 0x56365e554ac0] Multi frame detection: TFF:   137 BFF:     0 Progressive:   670 Undetermined:     0
 
Based on that, not too surprised that ffprobe says not interlaced. I will attach the ffmpeg log, but, it is as I say.
 
Is there any good way to better detect interlaced video? This is admittedly 4.3.1.0, there was some potential bug with deleting media libraries incorrectly in the new Emby server version, waiting for 4.4.1. But still, this video appears to be mostly progressive. This is recorded off of a HDHomeRun. 
 
Is there harm if you always deinterlace any time you are transcoding? I recall in Handbrake it was irrelevant with one of their options as it only deinterlaced specific interlaced frames so there was no harm in doing so with whatever method they were using. 
 
Looking at the media info shown by emby, is there anything else of value there that might be a hint it's interlaced? I don't see any but attaching.
 
It just looks bad when interlaced video is not deinterlaced when transcoding. 
 
What is the command line you use to detect interlaced video? Is it a ffprobe with -show_streams? That shows a field_order of progressive. Relevant section below. I've had 3 of the last 4 NBC videos show up as not interlaced.
 
[STREAM]
index=0
codec_name=mpeg2video
codec_long_name=MPEG-2 video
profile=Main
codec_type=video
codec_time_base=1001/30000
codec_tag_string=[2][0][0][0]
codec_tag=0x0002
width=1920
height=1080
coded_width=0
coded_height=0
has_b_frames=1
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=4
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
timecode=N/A
refs=1
id=0x31
r_frame_rate=60000/1001
avg_frame_rate=30000/1001
time_base=1/90000
start_pts=5559937130
start_time=61777.079222
duration_ts=356197841
duration=3957.753789
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]

 
 
 
 

ffmpeg-transcode-642c4c4a-84be-42ed-9a6a-91f1822ab1ab_1.txt

post-348227-0-82346400-1585631412_thumb.png

Edited by sfatula
Posted

 

 

Is there harm if you always deinterlace any time you are transcoding? 

Performance-wise yes, but it's true this is an area for possible improvement.

sfatula
Posted (edited)

Would it be possible for example to have a setting that specifies the format of any given channel? Default is progressive. In that way, I could specify somewhere in Emby settings which channels are interlaced. This would obviously only help DVR recordings. 

Edited by sfatula
Posted

Or maybe just always treat mpeg2 as interlaced, something along those lines.

  • Like 1
sfatula
Posted

Or maybe just always treat mpeg2 as interlaced, something along those lines.

 

That would work, and for those with devices that maybe always deinterlace and it is not an issue, perhaps a setting that says force deinterlace on mpeg2 or not. If you think it's a performance issue. Ideally, the setting would be in the client but server level may be good enough. If a setting is needed at all. I like it. 

Posted

Thanks for the feedback.

  • 1 month later...
sfatula
Posted

Thanks for the feedback.

 

Can you make this happen in the Beta Emby Server? On the surface, appears a small change (says he who is not writing the code).

Posted

This is something @@softworkz and I will have to think about how to tackle. Thanks.

Posted

 

Been seeing this fail more recently. Isn't it possible to mix interlaced video with non interlaced? ffprobe is saying the video is not interlaced. Running this command:

 

ffmpeg -filter:v idet -frames:v 100 -an -f rawvideo -y /dev/null -i 'KTEN News at 10 2020_03_30_22_00_00.ts'

 

 

There's something wrong with that detection method. I tried it on an mpegts stream with mpeg2video which is definitely interlaced and the output was total nonsense:

[Parsed_idet_0 @ 00000210bed8ee80] Repeated Fields: Neither:  8720 Top:    15 Bottom:    10                                       
[Parsed_idet_0 @ 00000210bed8ee80] Single frame detection: TFF:  4781 BFF:     3 Progressive:  2119 Undetermined:  1842           
[Parsed_idet_0 @ 00000210bed8ee80] Multi frame detection: TFF:  5749 BFF:     0 Progressive:  2996 Undetermined:     0             

So, there's no value in what you're getting from that command output.

 

I'm afraid though, but right now I got no time to find out the reason (I'm not familiar with that filter).

Posted

What you could do is to install the Diagnostics Plugin https://mediabrowser.github.io/Emby.DiagnosticsPlugin/

and activate "EDD File Generation".

 

Set the amount of frames to something like 5000 or 10000, play the file for a while. When you stop, an .edd file is generated in the log folder that you can post here.

 

 

Thanks

  • 2 years later...
Posted

Hi is there any update on this issue? I'm recording Scrapheap challenge on UK TV and there is a coin toss seemingly deciding whether it's considered 576p or 576i. This means that sometimes the video plays at 25fps when there is definitely 50 fields in the video.

 

Many thanks in advance,

Posted
1 hour ago, kenwonders said:

Hi is there any update on this issue? I'm recording Scrapheap challenge on UK TV and there is a coin toss seemingly deciding whether it's considered 576p or 576i. This means that sometimes the video plays at 25fps when there is definitely 50 fields in the video.

 

Many thanks in advance,

@kenwonders

 

Hi there, let's look at an example. Please attach the information requested in how to report a media playback issue. Thanks!

 

Posted (edited)

Hi Luke, thanks for replying, sorry that I hadn't really given you anything to think about...

And funnily I don't have any evidence, because whilst setting up a debug session I discovered that actually the series 9 episodes of scrapheap challenge being broadcast at the moment ARE 576p, and the previous series 8 episodes that I was comparing it to were going out in 576i.

They are being detected differently in the media info (in series 8 it says some are i some are p but they're all i), but the nvidia shield isn't caring about that information anyway and correctly managing the media regardless. In short, it's working great! Thanks.

Ken

Edited by kenwonders
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...