Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st March 2019, 06:01   #1  |  Link
cagali
Registered User
 
Join Date: May 2014
Posts: 46
How to encode 1080i source with x265 interlaced?

Source clip, a segment of a BD M2TS:
Code:
Bit depth                   : 8 bits
Scan type                   : Interlaced
Scan type, store method     : Separated fields
Scan order                  : Top Field First
Bits/(Pixel*Frame)          : 0.317
AVS:
Code:
LoadPlugin("LSMASHSource.dll")
LWLibavVideoSource("some.m2ts")

AssumeTFF()
SeparateFields() #actually the encoded .265 has the same md5 even if this line is removed
Command:
Code:
avs2yuv -raw %1.avs -o - | x265_SSSE3_32 --input-res 1920x1080 --fps 30000/1001 --interlace tff --preset medium --output %1.265 -- -
Using this setup, a resulting clip with the following mediainfo is encoded.

Quote:
...
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 29.970 (30000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Bits/(Pixel*Frame) : 0.127
Stream size : 46.0 MiB (100%)
Writing library : x265 3.0+1-ed72af837053:[Windows][GCC 8.2.0][32 bit] 8bit+10bit+12bit
Encoding settings : cpuid=1049071 / frame-threads=2 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x1080 / interlace=1
...
It cannot be correctly detected as 1080i TFF video with mpc-hc's lav video decoder using default settings.
If the "field order" is set to TFF instead of AUTO, the playback is somehow at 60fps.
However from the screen capture, it looks like it is force-deinterlacing a bad-deinterlaced progressive clip.

Are there any tools to check if the encoded clip is a properly interlaced one?
With mediainfo, it shows the "Scan type" of mpeg4 1080i as "MBAFF".
But for hevc 1080i clips, it shows nothing about the scan type.

Thank you very much!

(Yes interlaced mode is deprecated in x265.
This is just a test. )
cagali is offline   Reply With Quote
Old 21st March 2019, 07:48   #2  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,080
iirc.:
  • H.264 support Picture-adaptive frame/field (PAFF) and macroblock-adaptive frame/field (MBAFF) coding. So either per frame (paff) or macroblock (mbaff) it can decide whether to encode interlaced or progressive. (afaik x264 only supports MBAFF)
    read https://forum.doom9.org/showthread.php?t=96598 it should clear what is possible with H.264
    MediaInfo reports:
    • progressive encoding: "Scan type : Progressive" / "Frame Structure: Frame"
    • interlaced, PAFF: "Scan type : Interlaced" / "Frame Structure: Fields"
    • interlaced, MBAFF: "Scan type : MBAFF" / "Frame Structure: MBAFF"
    see: https://forum.doom9.org/showthread.p...00#post1631600
  • H.265 only has the old either the clip as a whole is encoded interlaced or it is encoded progressive.

Quote:
Are there any tools to check if the encoded clip is a properly interlaced one?
Not sure how to anwser this. Can you describe what's the difference between proper and improper interlaced content?

Personally I would look at the frames to decide whether the content is interlaced or not and then decide what I deemed best for my usage goal.

Cu Selur
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 21st March 2019, 08:22   #3  |  Link
cagali
Registered User
 
Join Date: May 2014
Posts: 46
Quote:
Originally Posted by Selur View Post
iirc.:
Not sure how to anwser this. Can you describe what's the difference between proper and improper interlaced content?
Please cmiiw,
For h264 clips...

if the "scan type" flag in mediainfo is MBAFF, and when checking the screen capture, there are combed edges for moving objects, it should be a proper one.

if the "scan type" flag in mediainfo is Progressive, but there are still combed edges, then it should be a bad-interlaced (or bad-deinterlaced) clip. It happens when an interlaced source is fed to the x264 encoder without the --tff switch.

Quote:
Personally I would look at the frames to decide whether the content is interlaced or not and then decide what I deemed best for my usage goal.
The source in the test is a truely interlaced/combed video, i.e. it is 30i before deinterlacing, and 60fps after that.

Last edited by cagali; 21st March 2019 at 13:31.
cagali is offline   Reply With Quote
Old 21st March 2019, 08:30   #4  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,080
Assuming this isn't just a wrongly flagged stream (flagging interlaced as progressive) and really interlaced content encoded progressively, I sadly don't know of any tool that will detect such cases.
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 21st March 2019, 08:58   #5  |  Link
cagali
Registered User
 
Join Date: May 2014
Posts: 46
Quote:
Originally Posted by Selur View Post
Assuming this isn't just a wrongly flagged stream (flagging interlaced as progressive) and really interlaced content encoded progressively, I sadly don't know of any tool that will detect such cases.
Thanks Selur.

Anyway it is just a side question.
The main one is "How to encode 1080i source with x265 interlaced (using avisynth)?"

cagali is offline   Reply With Quote
Old 21st March 2019, 09:28   #6  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,706
Quote:
Originally Posted by cagali View Post
Thanks Selur.

Anyway it is just a side question.
The main one is "How to encode 1080i source with x265 interlaced (using avisynth)?"

You could try
Code:
AssumeTFF()
separatefields()
Now encode with x265 using --interlace tff --sar 1:2

From the doc:
https://x265.readthedocs.io/en/defau...utable-options

HEVC encodes interlaced content as fields. Fields must be provided to the encoder in the correct temporal order. The source dimensions must be field dimensions and the FPS must be in units of fields per second. The decoder must re-combine the fields in their correct orientation for display.

Last edited by Sharc; 21st March 2019 at 09:43.
Sharc is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:19.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.