Hello everyone! I recently had the need to convert an interlaced video in M2TS format (With MPEG2 codec) with FFMPEG, to X264, using libx264 -crf. At the end of the conversion, I payed the new video with the VLC, and the quality is practically the same as the original video. Despite the fact that I did not use CRF0.I used CRF15.
*I had no problem playing the new viedo with the VLC.
The problem occurred when I transferred the new video to a USB storage device, in order to play the new video on my old version of Sony Bravia TV. It turns out that playing the new video on my Sony Bravia, I realized that the new video has Scanlines and comb artifacts. Those Scanlines and comb artifacts make viewing the video awkward and unpleasant.
Of course, The main reason of converting MPEG2 video to x264 is precisely to be able to play the video on my Sony TV, since my TV does not play videos with MPEG2 codec. The only way for my TV to play videos with MPEG2 codec, is to wrap it in a .M2TS container. But the problem is that my TV doesn't play secondary audios or subtitles when the video is in a M2TS container. Secondary audios and subtitles are always useful to me.
If I wrap the original video with MPEG2 codec to an MKV container, then it becomes totally unplayable on my Sony TV. That is why I have, or had the need to convert MPEG2 video to x264.
As I said before, the new video looks perfect playing it in VLC software, but not on my TV. I think this is because VLC autocorrect the Scanlines and comb artifacts.
So what I need is, can someone tell me, how to get the same conversion quality as I got using the parameters (-c: v libx264 -crf), but without the Scanlines and comb artifacts?
Which filter should I use? I think when you don't use an extra filter when you convert an interlaced video to any other video codec, FFMPEG automatically deinterlaces the video while converting.
Maybe using a filter that keeps the video interlaced could be the solution, but what would be the filter to use? I need some filter that keeps the video interlaced while using libx264 -crf. Or maybe a filter that deinterlaces the video without losing quality or losing just the minimum quality.
Sorry for all the misspelling, Im not a english native speaker.
Anyone out there who can help me with this?
+ Reply to Thread
Results 1 to 21 of 21
Last edited by Rizoko; 15th May 2020 at 19:03.
Sony has the worst media players. The fact that VLC is playing your converted video without comb artifacts indicates it is encoded interlaced and properly flagged. It's your TV's media player that's at fault. Since you can't do anything about the TV you can deinterlace when you encode. Try the yadif or bwdif filter.
You may have to downscale to 720p if you use the double frame rate options.
You can encode it interlaced (really MBAFF if using libx264), and your TV will deinterlace it
-flags +ilme+ildct -x264opts tff=1
But definitely I dont wanna to downscale the video to 720p.
TV. I will give those filters a try! Thanks!
VLC to deinterlace or did it automatically detect the video was interlacded? If the former then poisondeathray's suggestion may work.
Another possibility if this is a movie or TV show: it should be inverse telecined to 23.976 fps and encoded progressive, or, if PAL field matched and encoded progressive at 25 fps.
Last edited by jagabo; 15th May 2020 at 19:06.
MediaInfo. It will tell you if it is encoded interlaced.
FFMPEG , I also used -level:v 4.0 Is that related to the problem? I didnt try with Level 3.1 or something like that.
Here are some screenshots of my TVs codecs Guide:
https://mega.nz/file/fE0m0Saa#kGeFJ-PlUoAogZIU77i9kJuEy5aEaGNUUoGwtB6k-V8 https://mega.nz/file/HEkG0CjY#xaktL8FHlz0Butv-Xai4c65fFXQEmwBdVqcmwTl1uKo https://mega.nz/file/3F0CnQyL#bFDfXM6sgEa9Qo0RdRis5ABcMDTgjxK5to3hvc9wT0Y
Here is the Info of the Original Interlaced video with MPEG2 codec which is playable on my TV but without Subtitles and secondary audio options.
General ID : 1 (0x1) Complete name : King.m2ts Format : BDAV Format/Info : Blu-ray Video File size : 18.4 GiB Duration : 3 h 7 min Overall bit rate mode : Variable Overall bit rate : 14.0 Mb/s Maximum Overall bit rate : 35.5 Mb/s Movie name : KING Law rating : PG-13 Video ID : 4113 (0x1011) Menu ID : 1 (0x1) Format : MPEG Video Format version : Version 2 Format profile : Main@High Format settings : CustomMatrix / BVOP Format settings, BVOP : Yes Format settings, Matrix : Custom Format settings, GOP : M=2, N=14 Codec ID : 2 Duration : 3 h 7 min Bit rate mode : Variable Bit rate : 12.4 Mb/s Maximum bit rate : 14.0 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate : 29.970 (30000/1001) FPS Standard : Component Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Compression mode : Lossy Bits/(Pixel*Frame) : 0.200 Stream size : 16.3 GiB (89%) Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709
General Unique ID : 224301376682332179925768733955278093026 (0xA8BEDFB0D4C2EE55B68BCF32F555BAE2) Complete name : K:\King.mkv Format : Matroska Format version : Version 4 File size : 14.8 GiB Duration : 2 h 24 min Overall bit rate : 14.7 Mb/s Encoded date : UTC 2020-05-14 01:59:29 Writing application : mkvmerge v6.1.0 ('Old Devil') built on Mar 2 2013 14:32:37 Writing library : libebml v1.3.0 + libmatroska v1.4.0 Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference : 4 frames Codec ID : V_MPEG4/ISO/AVC Bit rate : 14.0 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Writing library : x264 core 157 r2935 545de2f Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 Default : Yes Forced : No
Last edited by Rizoko; 15th May 2020 at 20:25.
MediaInfo will usually show:
Scan type : Interlaced Scan order : Top Field First (or Bottom Field First)
So your source video is encoded progressive even though it contains interlaced frames. MediaInfo is showing your x264 encoding is variable frame rate and is also progressive (presumably keeping the interlaced frames). You can use the options PDR mentioned to force x264 to encode the frames interlaced. If your TV supports that you will no longer see comb artifacts when playing it. But there will be blended chroma artifacts from the progressive MPEG 2 encoding -- visible when colored objects are moving.
I recommend you upload a short (10 sec?) sample of your source with moderate motion -- not reencoded.
But, as I said before, maybe it's just my impression, about the quality of both.
Maybe there is no difference about quality using only (-c: v libx264 -crf) without "-flags + ilme + ildct -x264opts tff = 1" and using both together.
I am having some headaches lately, which prevent me from seeing clearly the differences between both videos. Lol.
I know you are a master about video encoding or about video codecs, edition, etc. But I think my original MPEG2 video is Interlaced. Because when I load it in TSmuxer, Tsmuxer shows me the info confirming its Interlaced. The video name appears as (i) which means Interlaced, not as (p) which means Progressive.
Here is an screenshot:
[Attachment 53343 - Click to enlarge]
But its on the pending upload a 10 secs fragment of the original video.
Thanks for all the help! I really appreciate it!
Last edited by Rizoko; 16th May 2020 at 16:09.
Is it a "movie"? Where is it from originally ? It says "(pulldown") , which could indicate 23.976p with telecine (progressive content encoded as interlaced fields)
Most "movies" are not interlaced in terms of content. They are progressive and only telecined for TV (pulldown added). The proper treatment would be to inverse telecine, or reverse the process to get back the original frames at 23.976p
Post the sample video . You can split a section with tsmuxer
@poisondeathray @jagabo Hey guys! I finally uploaded a fragment of the original MPEG2 video file! Maybe you guys are not gonna believe me, but split a certain fragment of the original video was not easy at all. it took me all long day. I wanted to upload a part of the video where Scanlines are visible, thats why I didn't want to upload the part or section of the beginning of the movie since there was not Scanlines in the first 40 secs, and there was no software able to split a specific section of the video. Not even TSmuxer was able to do that. When I selected a specific section to be splitted in TSmuxer I just got audio wrapped in a M2TS container, I tried like 10 different softwares, and I didn't get a solution. All the other softwares gave me the same results. Believe or not the original MPEG2 video file is such a mysterious video file. It's not a manoeuvrable video file. The only way I got to be able to split a spicific time or part of the video, was changing the M2TS container to a MKV container, and then load it to Avidemux. Avidemux did the Splitting job with/to the MKV container.
You guys can check/test the original video fragment yourselves, and try to pass/change the video fragment that I uploaded, to M2TS using TSmuxer or any video software tool of your choice, and you will see that it cannot be done.
But please guys, give me your opinion after you play the fragment of the original video on your media players.
Please test it or check it in VLC, MPHC, and even transfer the fragment of the video to your USB device storage and plug-n-play on your TV.
Here is the link to download the fragment of the original MPEG2 video file:
Last edited by Rizoko; 16th May 2020 at 21:18.
It's 23.976p content. You should IVTC. In ffmpeg it would be
It's not as reliable as avisynth or vapoursynth for IVTC - that's what I would use
or If your TV can detect the cadence an IVTC on the fly, it's probably better, leave it as fields with the telecine. But if it only deinterlaces, it's not as good the quality will be worse
FFmpeg . It drops the wrong frames (jerky), keeps the wrong frames (duplicates), missing combing
Or I have to use both options together in FFMPEG command?
If your TV can IVTC on the fly (3:2 cadence detection, most should be able to) , the 1st option is better. Unless you want to learn avisynth
Ive never used Avisynth or Vapoursynth before. Are Avisynth or Vapoursynth easy to use?