You are not logged in.

#1 2009-07-24 15:00:53

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Best tool for Inverse Telecining and deinterlacing ?

I have very limited experience in encoding videos before.
Recently I'm trying to transcode a DVD into H.264 with x264. All the VOB files are dumped already.

As for the video part, I've decided to do it this way :

mkfifo TEMP.y4m
x264 OPTIONS -o OUTPUT.mkv TEMP.y4m & mplayer -vo yuv4mpeg:file=TEMP.y4m OPTIONS INPUT.VOB

I believe this method to be clean and efficient.

The problem is: This VOB file is in NTSC format, and I'm pretty convinced that it's telecined, after reading this:

http://www.doom9.org/ivtc-tut.htm wrote:

TELECINE is a process where the FILM first is slowed down to 23.976 frames/second. Then for every 4 frames, an extra frame is created from fields of adjacent frames. If a frame consists of two fields, top (t) and bottom (b) and the original sequence is 1t1b 2t2b 3t3b 4t4b, then the telecined sequence would be 1t1b 2t2b 2t3b 3t4b 4t4b (commonly called 2:3 pull down because of the alternating 2 field, 3 field progression). This also means that the frame rate increases to 29.97 frames/second.

I viewed the video frame by frame, and found out that there're 2 sequential interlaced frames out of every 5 in a non-static scene. These are 2t3b 3t4b frames I think.

mplayer comes with some video filters that might help: With "-vf pp=" the result isn't that satisfying, but "-vf pullup" do the job nicely, that is, I can almost see no interlacing at all with this command:

mplayer -vf pullup VTS_01_1.VOB -noconfig all

On the other hand, I also noticed that there're 2 sequential repeated frames out of every 5 in a non-static scene. The frame-rate is 29.970 fps. This is bad because repeating means inefficiency in terms of compression. The better result is using only one of these 2 repeated frames at a frame-rate of 23.976 fps, which means dropping 20% extra frames.

But I don't know how to achieve this.

I want to achieve this at the mplayer decoding stage, so that x264 is fed with a yuv4mpeg source stream with no interlacing or extra frames.

------------------------------------------------------------------------------------------+

I'm not familiar with mencoder's options, though it seems to be able to drop the extra frame with "-vf pullup,softskip -ofs 24000/1001", but I can't find a way to let mencoder output as yuv4mpeg. Also there is a reason why I tend to avoid using mencoder:

mencoder -ss 209 -endpos 20 -ovc copy -oac copy -o _short_.vob VTS_01_1.VOB

This is supposed to cut a 20-second short clip from the VOB using copy. But even task as this simple could be wrong...which is really disappoiting. Look at these 2 screen shots.

By using mencoder -ovc copy::
http://omploader.org/vMjE3Zw

The original (mplayer VTS_01_1.VOB)::
http://omploader.org/vMjE3aA

Maybe it's just my build of mencoder(compiled at home)... But with this I really can't say mencoder is to be trusted.
...Or, is it something wrong in my command?

-------------------------------------------------------------------------------------------+

By the way, for this specific DVD, I believe mplayer plus x264 together can achieve the best result; on the other hand, just as the title suggests, I'd like to find some decent tool to do IVTC and Deinterlacing. CLI preferred but good GUI apps are also welcome wink

Thanks in advance!

Last edited by lolilolicon (2009-07-25 03:31:59)


This silver ladybug at line 28...

Offline

#2 2009-07-25 06:12:25

droog
Member
Registered: 2004-11-18
Posts: 877

Re: Best tool for Inverse Telecining and deinterlacing ?

The secret rin path is a hoax!!

I would ask skottish if i were you, he has the same ideals and great ffmpeg knowledge.
i use the old mencoder commands still sad

Offline

#3 2009-07-25 07:32:09

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Best tool for Inverse Telecining and deinterlacing ?

I've never done this, but I think that you can skip mencoder completely and pipe directly out of Mplayer with the yuv4mpeg driver ( -vo yuv4mpeg ). You should be able to use the -vf pullup,softskip stuff still.

By the way, FFmpeg does not have any ivtc conversion code. It won't be implemented until avfilter is more complete and someone gets around to writing the plug-in. Also, mencoder is as good as toast. It's barely maintained and will probably die off when avfilter gets some community interest.

Offline

#4 2009-07-25 07:34:16

Klepper
Member
From: Nürnberg, Germany
Registered: 2007-08-18
Posts: 21

Re: Best tool for Inverse Telecining and deinterlacing ?

Have you checked the mplayer man page? It says to always use the softskip filter together with pullup
Mplayer has quite some ivtc filters.
It's been quite some time that I actually did this myself and there may be better filters available now(pullup?). I always used something like that

-vf filmdint=crop=706:365:12:62=mmx2=1,scale=608:272 -sws 10 -fps 29.97 -ofps 23.976

(filmdint has a builtin cropping filter that is faster in this case)

Last edited by Klepper (2009-07-25 07:35:03)

Offline

#5 2009-07-25 09:18:35

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Best tool for Inverse Telecining and deinterlacing ?

skottish wrote:

You should be able to use the -vf pullup,softskip stuff still.

man mplayer wrote:

Softskip
Only  useful  with MEncoder.  Softskip moves the frame skipping (dropping) step of encoding from before the filter chain to some point during the filter chain.  This allows filters which need to see all frames (inverse  telecine,  temporal  denoising,  etc.)

Actually, when I tried::

mplayer -vf pullup,softskip VTS_01_1.VOB -noconfig all

The result is the same as just using "-vf pullup". The extra frame can't be dropped by mplayer this way......

Too bad many "convenient" tools like h264enc all use mencoder. I don't know whether handbrake does too. Haven't tried it out.
Avisynth is a great tool but works only for windows. x264's built in deinterlaced mode does no good in my case. ffmpeg's filters are still too limited by far. What can I do? Is there anything that does nothing but good IVTC?

-------------------------------------------------------------------------------------+

Klepper wrote:

It says to always use the softskip filter together with pullup

man mplayer wrote:

Always  follow  pullup  with the softskip filter when encoding to ensure that pullup is able to see each frame.

In my case, pullup seems to work better than filmdint: I've just tried the h264enc script which is almost totally a frontend to mencoder. Look at the mencoder filters it used:

mencoder VTS_01_1.VOB -o 01.avi -fps 30000/1001 -ofps 24000/1001 -vf filmdint=fast=0/io=30:24/dint_thres=256,softskip,harddup -oac pcm -ovc x264 -x264encopts <x264OPTIONS>

See, it also used filmdint as you suggust. The result is not too bad: removed the extra frame and plays at 24fps. But I can still notice interlacing occasionally. Maybe it's because the video isn't constant pattern "PPPII" but with some shifting (say, PPPIIPPPII...PPPIIPIIPPPIIPPPII, I found some pattern like this in the source VOB)
Man page says "io=<ifps>:<ofps>" must match "-fps/-ofps" ("-fps 30000/1001" and "-ofps 24000/1001" in my case.)
Since -ofps is an option ONLY for mencoder, but not for mplayer, filmdint can't make mplayer drop the extra frame like mencoder.
I played the VOB with "mplayer -vf filmdint=fast=0/io=30:24 VTS_01_1.VOB -noconfig all" and there're lots of "@@@@@@@@ Bottom-first field??? @@@@@@@@" spitted out in the console. I read about this in the man page but don't understand....

If the source is MPEG-2, [u]this must be the  first  filter to allow access to the field-flags set by the MPEG-2 decoder[/u].  Depending on the source MPEG, you may be fine ignoring this advice, as long as you do not see lots of "Bottom-first field" warnings.

I don't have any other filters in the command line, so... why?
The occasional interlacing is the same as the video encoded with h264enc. Also, it did not drop the extra frame anyway.

-------------------------------------------------------------------------------------+

Also I have a doubt:
In my first post, I wrote:
The original (mplayer VTS_01_1.VOB)::
http://omploader.org/vMjE3aA
But I think even this is not "original" -- not as good as the original video before it was telecined into NTSC format. I think it's mplayer not doing it good enough. The real original frame should have no blocking......
I've compared it to one fansub rip, the same frame looks better than in the image above, very little blocking, also the bass string isn't blurred like in the image above:
http://omploader.org/vMjE5aw
I don't know how they did it. And I actually want to do it better big_smile

Last edited by lolilolicon (2009-07-25 09:32:30)


This silver ladybug at line 28...

Offline

#6 2009-07-25 11:34:12

Xemertix
Member
Registered: 2009-04-09
Posts: 66

Re: Best tool for Inverse Telecining and deinterlacing ?

I suggest you using Avisynth with wine and avsproxy-avidemux or virtual dub,it should works just fine..
Have a look to these pages
http://www.doom9.org/index.html?/decomb.htm
http://avisynth.org/mediawiki/External_ … nterlacing
http://avisynth.org/SelectEvery and so on..

I'm not very good at scripting,but you can try something similar (this is only an example,change the values!):

LoadPlugin("C:\Programs\AviSynth 2.5\plugins\DGDecode.dll")

Mpeg2Source("C:\x.d2v")
AssumeTFF()#depending on your video field order
Bob(height=576)#depending on your video height
SeparateFields()
SelectEvery(10, 0,1, 2,3, 2,3, 4,5, 6,7, 8,9)#You can analyze a series of 100 frames from a video sequence with high motion writing on paper the type of frame (I,P,etc),and with a similar command you can choose the best frames to keep..
Weave()

Last edited by Xemertix (2009-07-25 11:34:56)

Offline

#7 2009-07-25 13:26:03

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Best tool for Inverse Telecining and deinterlacing ?

I just read at transcode's docs about its ivtc/decimate filters:
http://www.transcoding.org/cgi-bin/tran … ow_To_Cope

The algorithms used in these filters are the basic ones used in the 'Decomb' package (made by Donald A. Graft and available - unfortunately - only under Windows).

I guess this doc is a little out of date because I do see "Decomb telecide" in Avidemux.
http://avidemux.org/admWiki/index.php?t … b_Telecide
I haven't tried it because I don't know how to get it to work with avidemux2_cli...

mplayer doesn't seem to support this "Docomb" algrithom :-(

But since avidemux seems to have Decomb ported to to linux, hopefully there are other linux apps that support Decomb. Though I have not yet found any :-(

Xemertix wrote:

I suggest you using Avisynth with wine and avsproxy-avidemux or virtual dub,it should works just fine

Yes, I think so. This problem I've encontered is a really basic situation for a expierenced encoder.
Since I don't like wine, I'd rather do it under XP if I have to use Avisynth. Then I'll be using Virtual Dub Mod, MeGUI, x264.exe, etc.....

But wait, before actually reboot into windows, let's stick to linux a little further... I believe linux can do it very well! Why?

http://www.linuxmovies.org/ wrote:

Linux is used to create practically every blockbuster movie in theaters today, movies produced by Disney/Pixar, DreamWorks Animation, Sony, ILM, and other studios.

So...


This silver ladybug at line 28...

Offline

#8 2009-07-25 14:33:59

Xemertix
Member
Registered: 2009-04-09
Posts: 66

Re: Best tool for Inverse Telecining and deinterlacing ?

http://www.linuxmovies.org/ wrote:
Linux is used to create practically every blockbuster movie in theaters today, movies produced by Disney/Pixar, DreamWorks Animation, Sony, ILM, and other studios.

I hypothesize they use mainly proprietary or customized professional applications on those linux workstations,and programs like cinepaint,cinerella etc for other side tasks.
Windows is,at present,unbeatable when dealing with "ripping" because it's compatible with the best programs in this area (avisynth and thousands of advanced video filters,virtual dub,dgindex,avsp,etc..) that are gpl but not cross-platform...

Offline

#9 2009-07-28 17:09:05

Klepper
Member
From: Nürnberg, Germany
Registered: 2007-08-18
Posts: 21

Re: Best tool for Inverse Telecining and deinterlacing ?

regarding your screenshots: by default mplayer muxes to AVI. you explicitly need to tell it to mux your video file into something else, i.e. mpeg2. maybe mplayer has problems playing those back
Wait, maybe not. Repeating your steps on my machine gives me:
117.png
heavily interlaced but no blocks


Are you sure the source is telecined? With FLCL being an OVA series I'd guess it's interlaced. My german DVDs sure are

Offline

#10 2009-07-31 12:42:08

brownkenny
Member
Registered: 2007-08-07
Posts: 8

Re: Best tool for Inverse Telecining and deinterlacing ?

I'd recommend trying HandBrake. It doesn't use mencoder, and has some great filters for detelecining and decombing video. It's what I use for all my video encoding. In fact, I'm using the most recent svn version with no problems.

Offline

#11 2011-02-21 04:33:18

pineapplecakes
Member
Registered: 2011-02-21
Posts: 1

Re: Best tool for Inverse Telecining and deinterlacing ?

I know this is over a year old, but I had the exact same problem as OP and just spent hours figuring it out, and now that I have I'm so proud I registered an account to share.

My telecined dvd is in a folder called MIRAGE.

#!/bin/bash

device=MIRAGE
out=Mirage2004.mkv
width=720
height=480
vpre=medium
crf=22

mkfifo /tmp/videopipe.y4m
mkfifo /tmp/videopipe2

#encode video
x264 /tmp/videopipe.y4m --crf $crf --preset $vpre --threads auto -o /tmp/$device-264.mkv & mencoder dvd://1 -dvd-device $device -nosub -vf pullup,softskip,format=i420,scale=$width:$height -ofps 24000/1001 -nosound -ovc raw -of rawvideo -really-quiet -o - | mplayer - -rawvideo w=$width:h=$height:fps=24000/1001:format=i420 -demuxer rawvideo -aspect 16:9 -benchmark -vo yuv4mpeg:file=/tmp/videopipe.y4m -really-quiet 2>/dev/null

#encode audio
mplayer dvd://1 -dvd-device $device -nocache -aid 128 -dumpaudio -dumpfile /tmp/$device.ac3 -really-quiet 2>/dev/null
ffmpeg -i /tmp/$device.ac3 -acodec libfaac -ar 44100 -ab 128k -ac 2 /tmp/$device.aac -threads 0

#merge
mkvmerge -o $out /tmp/$device-264.mkv /tmp/$device.aac


Basically, to do inverse telecine you MUST use mencoder, because mplayer (while having the necessary -vf pullup filter) DOESN"T have the ability to change framerate, which is crucial for a/v sync.

Inverse telecine changes framerate from 30000/1001 --> 24000/1001

for mencoder, -vf pullup,softskip is what actually does the inverse telecine, and -ofps 24000/1001 is what makes sure the audio and video stay in sync.  All the other gibberish is to pipe the output from mencoder into mplayer using a raw pipe so that mplayer can then output the result to yuv4mpeg pipe, which is the best way to pipe something into x264.  (x264 needs raw video to input as i420 color space, which the yuv4mpeg pipe does automatically, and while mencoder does technically have the format=i420, it's broken so you can't pipe from mencoder to x264 directly)

Offline

Board footer

Powered by FluxBB