Log in

View Full Version : Proper IVTC using exclusively ffmpeg


Ely
26th June 2015, 18:18
Hellow !

I have a source that is 1080i MPEG-2 NTSC TS running at 29.97fps. I'm trying to achieve a proper inverse telecine but I'm running on a linux environment and I don't want to hassle with avisynth.

After a LOT of testing, this is the command that gives me the best results :

ffmpeg -i input.1080i.ts -vf fieldmatch,yadif=deint=interlaced,mpdecimate=max=-4:hi=1000:frac=1 -r 23.976 out.mp4

For clarity I removed the a/v codecs parameters because they're not important here (standard libx264/aac stuff).

This produces an excellent IVTC and the resulting video looks awesome 95% of the time. For the remaining 5%, there are frame misses/duplicates due to the mpdecimate filter either failing to detect a duplicate or dropping a valid frame.

I decided to go with mpdecimate instead of decimate because it gave me better and more consistent results.

I also took the decision of setting frac=1, disabling the frac/lo part of the mpdecimate filter because I found it to produce worse duplicate detection (https://ffmpeg.org/ffmpeg-filters.html#mpdecimate)

If you have any idea of what I could change to improve my IVTC, I'll take it. Thanks!

Ely
1st July 2015, 14:44
Soo for anyone interested, I've come back with 2 things :

- For some kind of telecined content, ffmpeg will do a great job of IVTC with the following simple filters :

ffmpeg -i input.1080i.ts -vf fieldmatch,yadif=deint=interlaced,decimate out.mp4

- For other kind of content that is still 29.97i with a mix of progressive and interlaced frames but where ffmpeg fails to IVTC using fieldmatch+decimate, I had to pipe using another program, yuvkineco :

ffmpeg -i input.1080i.ts -vf fieldmatch,yadif=deint=interlaced -f yuv4mpegpipe -pix_fmt yuv420p - | yuvkineco -F 1 -n 2 -i -1 | x264 --demuxer y4m -o out.mp4 -

The result turned out really great.