Pullup old MPEG-2

classic Classic list List threaded Threaded
30 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Pullup old MPEG-2

llee782
I’m getting unexpected results from a process that I’ve previously used successfully to detelecine old DVDs when converting to h264.

Here’s my source excerpt:
https://dl.dropboxusercontent.com/u/42718751/2023_telecine_source.zip

Here’s the correctly converted excerpt using mencoder with the command line, "mencoder '2023_telecine_source.mpg' -o '2023_telecine_detelecine.m4v' -of lavf -lavfopts format=mp4 -alang en -aspect 4:3 -demuxer lavf -vf filmdint=fast=0/sad_thres=2048,fspp,softskip -mc 0 -noskip  -oac faac -faacopts br=320:mpeg=4:object=2:raw  -ofps 24000/1001 -ovc x264 -x264encopts crf=28:bitrate=2000:nocabac:level_idc=31:bframes=0:global_header:threads=auto:subq=6:frameref=2:partitions=all:trellis=1:chroma_me:qcomp=0.7:qp_step=4:me=umh:weightp=0:8x8dct=0:direct_pred=auto ‘“:
https://dl.dropboxusercontent.com/u/42718751/2023_mencoder_detelecine.zip

Here’s the incorrectly converted excerpt using ffmpeg with the command line, "ffmpeg -i '2023_telecine_source.mpg' -pix_fmt yuv420p -c:v libx264 -preset slower -tune film -vf "fieldmatch=order=tff:combmatch=full" -r 24000/1001 -c:a libfdk_aac -b:a 320k -crf 18 -x264opts keyint=40:bitrate=2100:qpmin=8:qpmax=28:qpstep=4 '2023ffmpeg_telecine..m4v’”:
https://dl.dropboxusercontent.com/u/42718751/2023_ffmpeg_detelecine.m4v.zip

Please tell me how ffmpeg may be used to correctly detelecine the source so that the output compares favorably with the mencoder output. Thanks.

Laine Lee

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
Laine Lee <llee040 <at> sbcglobal.net> writes:

> -vf "fieldmatch=order=tff:combmatch=full" -r 24000/1001

This cannot work, please look at the documentation.

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
Thanks. Well, it worked as well as "ffmpeg -i '2023_telecine_source.mpg' -pix_fmt yuv420p -c:v libx264 -preset slower -tune film -vf "fieldmatch=order=tff:combmatch=full,fps=24000/1001" -c:a libfdk_aac -b:a 320k -crf 18 -x264opts keyint=40:bitrate=2100:qpmin=8:qpmax=28:qpstep=4 '2023ffmpeg_telecine..m4v’” when I changed it from the above after resorting to wild guesses, but please consider the above as what was used, because it yields results which are just as incorrect. Know of any way to fix it?

Laine Lee

> On Dec 18, 2015, at 5:57 PM, Carl Eugen Hoyos <[hidden email]> wrote:
>
> "fieldmatch=order=tff:combmatch=full"
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
Laine Lee <llee040 <at> sbcglobal.net> writes:

> -vf "fieldmatch=order=tff:combmatch=full,fps=24000/1001"

Where did you find this?

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
Thanks.

On 12/18/15, 7:05 PM, "ffmpeg-user on behalf of Carl Eugen Hoyos" <[hidden email] on behalf of [hidden email]> wrote:

Laine Lee <llee040 <at> sbcglobal.net> writes:

 -vf "fieldmatch=order=tff:combmatch=full,fps=24000/1001"

Where did you find this?

http://ffmpeg-users.933282.n4.nabble.com/FFMpeg-problem-using-fieldmatch-and-decimate-filters-to-IVTC-td4665052i20.html#a4665298

I need to provide a different set of excerpts, and ask my question again, because applying the command, “ffmpeg -i 2023_telecine_source.mpg -pix_fmt yuv420p -c:v libx264 -preset slower -tune film -vf "fieldmatch=order=tff:combmatch=full,fps=24000/1001" -c:a libfdk_aac -b:a 320k -crf 18 -x264opts keyint=40:bitrate=2100:qpmin=8:qpmax=28:qpstep=4 2023_ffmpeg_telecine.m4v” to the source clip I previously provided (https://dl.dropboxusercontent.com/u/42718751/2023_telecine_source.zip) correctly transcodes it.

So here goes.

Here’s my source excerpt:
https://dl.dropboxusercontent.com/u/42718751/2024_telecine_source.zip

Here’s the correctly converted excerpt using mencoder with the command line, "mencoder 2024_telecine_source.mpg -o 2024_mencoder_detelecine.m4v -of lavf -lavfopts format=mp4 -alang en -aspect 4:3 -demuxer lavf -vf filmdint=fast=0/sad_thres=2048,fspp,softskip -mc 0 -noskip  -oac faac -faacopts br=320:mpeg=4:object=2:raw  -ofps 24000/1001 -ovc x264 -x264encopts crf=28:bitrate=2000:nocabac:level_idc=31:bframes=0:global_header:threads=auto:subq=6:frameref=2:partitions=all:trellis=1:chroma_me:qcomp=0.7:qp_step=4:me=umh:weightp=0:8x8dct=0:direct_pred=auto“:
https://dl.dropboxusercontent.com/u/42718751/2024_mencoder_detelecine.zip

Here’s the incorrectly converted excerpt using ffmpeg with the command line, "ffmpeg -i 2024_telecine_source.mpg -pix_fmt yuv420p -c:v libx264 -preset slower -tune film -vf "fieldmatch=order=tff:combmatch=full,fps=24000/1001" -c:a libfdk_aac -b:a 320k -crf 18 -x264opts keyint=40:bitrate=2100:qpmin=8:qpmax=28:qpstep=4 2024_ffmpeg_detelecine.m4v”:
https://dl.dropboxusercontent.com/u/42718751/2024_ffmpeg_detelecine.zip

Please tell me how ffmpeg may be used to correctly detelecine the source so that the output compares favorably with the mencoder output. Thanks.

Laine Lee


_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
In reply to this post by Carl Eugen Hoyos
BTW, -vf pullup -r 24000/1001, doesn’t work on the clip (https://dl.dropboxusercontent.com/u/42718751/2024_telecine_source.zip), either, when I used "ffmpeg -i 2024_telecine_source.mpg -vf pullup -r 24000/1001 2024_ffmpeg_detelecine.m4v.”

Laine Lee


On 12/18/15, 7:05 PM, "ffmpeg-user on behalf of Carl Eugen Hoyos" <[hidden email] on behalf of [hidden email]> wrote:

Laine Lee <llee040 <at> sbcglobal.net> writes:

 -vf "fieldmatch=order=tff:combmatch=full,fps=24000/1001"

Where did you find this?

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
Laine Lee <llee040 <at> sbcglobal.net> writes:

> BTW, -vf pullup -r 24000/1001, doesn’t work on the clip
> https://dl.dropboxusercontent.com/u/42718751/2024_telecine_source.zip

This is progressive content, you cannot use an
inverse telecine filter on it (and expect useful
output).

Please do not top-post here, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
In reply to this post by llee782
On 12/20/15, 5:27 AM, "ffmpeg-user on behalf of Carl Eugen Hoyos" <[hidden email] on behalf of [hidden email]> wrote:


>Laine Lee <llee040 <at> sbcglobal.net> writes:
>
>> BTW, -vf pullup -r 24000/1001, doesn’t work on the clip
>> https://dl.dropboxusercontent.com/u/42718751/2024_telecine_source.zip
>
>This is progressive content, you cannot use an
>inverse telecine filter on it (and expect useful
>output).

After receiving this, I tried -vf yadif=deint=interlaced -r 24000/1001, and that seemed to work well.

>
>Please do not top-post here, Carl Eugen

Okay. Thanks.

Laine Lee



_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
Laine Lee <llee040 <at> sbcglobal.net> writes:

> >> BTW, -vf pullup -r 24000/1001, doesn’t work
> >> on the clip
> >> https://dl.dropboxusercontent.com/u/42718751/2024_telecine_source.zip
> >
> >This is progressive content, you cannot use an
> >inverse telecine filter on it (and expect useful
> >output).
>
> After receiving this, I tried
> -vf yadif=deint=interlaced -r 24000/1001

It of course (also) makes no sense to use a
deinterlace filter on progressive content.
Note that contrary to an inverse telecine
filter, a deinterlace filter permanently
damages the original stream.
There is no guarantee that using the deint
option helps, the information is often not
available.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
On 12/20/15, 5:01 PM, "ffmpeg-user on behalf of Carl Eugen Hoyos" <[hidden email] on behalf of [hidden email]> wrote:



>Laine Lee <llee040 <at> sbcglobal.net> writes:
>
>> >> BTW, -vf pullup -r 24000/1001, doesn’t work
>> >> on the clip
>> >> https://dl.dropboxusercontent.com/u/42718751/2024_telecine_source.zip
>> >
>> >This is progressive content, you cannot use an
>> >inverse telecine filter on it (and expect useful
>> >output).
>>
>> After receiving this, I tried
>> -vf yadif=deint=interlaced -r 24000/1001
>
>It of course (also) makes no sense to use a
>deinterlace filter on progressive content.
>Note that contrary to an inverse teleci
>filter, a deinterlace filter permanently
>damages the original stream.
>There is no guarantee that using the deint
>option helps, the information is often not
>available.

 The reason I originally included my mencoder recipe was that I had hoped it could provide clues for finding an ffmpeg equivalent that deals as favorably with pullup for as many different types of input. My mencoder method's only real deficiency (other than being dependent on deprecated software) is that I always get underruns if I try to copy audio rather than encode. The ffmpeg method I had already developed works pretty well, with the apparent exception of certain 4x3 DVD titles such as the one for which I provided the excerpt.

Laine

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
Laine Lee <llee040 <at> sbcglobal.net> writes:

> The reason I originally included my mencoder recipe
> was that I had hoped it could provide clues for
> finding an ffmpeg equivalent that deals as favorably
> with pullup for as many different types of input.

Your MEncoder command line includes "-ofps 24000/1001".
How is this supposed to work for 30fps progressive
input?

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
Carl Eugen Hoyos wrote
Your MEncoder command line includes "-ofps 24000/1001".
How is this supposed to work for 30fps progressive
input?
The inverse telecine operation must yield video of 23.94 fps rather than 29.97 fps, right?

Laine
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Nicholas Robbins-2
> On Monday, December 21, 2015 12:39 AM, llee782 <[hidden email]> wrote:

> > Carl Eugen Hoyos wrote
>>  Your MEncoder command line includes "-ofps 24000/1001".
>>  How is this supposed to work for 30fps progressive
>>  input?
>
> The inverse telecine operation must yield video of 23.94 fps rather than
> 29.97 fps, right?
>
> Laine


Laine,

It seems like you may be asking too much from your command. Having spent some time converting dvd's to mkv's, I've encountered the following on dvds:

1) 24 fps labeled 30fps
2) 24 fps telecined to 30fps
3) 30 fps interlaced material
4) 30 fps progressive material
5) a mix of 2 & 4 in the same title

6) a mix of 1 & 2 in the same title
7) a mix of 2 & 3 in the same title
8) a mix of 3 & 4 in the same title

9) 25 fps telecined to 30 fps (PAL->NTSC)
10) Rarely, 24 fps -> 30 fps by duping every 4th frame.


I have a different ffmpeg "-vf" command for each option, and there is no automated way to tell what is what (except I can detect 1) by actually counting the frames.)

You have to use your eyes. Just find a scene with some horizontal movement, a pan or a person walking across the shot, looking for combing, if there is combing on every frame, it is probably interlaced. If there is combing for 2 frames out of every five, it is probably telecined. If there are effect shots, check them separately, they might be made differently. If there are lots of shots of TV's check those separately too.


There is no single command that will do the correct thing will all of these. If you through enough fieldmatch's and yadif's at it you will get rid of all the combs, but you will also produce blurry juddery video.

The ffmpeg commands I use are:

1) -r 24000/1001 (I've also used -fps=24000/1001, but -r works better for me for this)
2) -vf fieldmatch,decimate (produces 24000/1001)

3) -vf yadif=mode=1 (produces 60)
4) Nothing
5) -vf pullup,dejudder,fps=fps=120000/1001:round=zero (Leave of the fps if you can deal with vfr output)

6) -vf pullup,dejudder,fps=fps=24000/1001:round=zero  
7) -vf pullup,dejudder,idet,yadif=mode=1:deint=interlaced,fps=fps=120000/1001:round=zero (leave off fps if you can deal with vfr output) 8) -vf idet,yadif=mode=1:deint=interlaced,fps=fps=60000/1001:round=zero
9) -vf fieldmatch,decimate=6
10) -vf decimate=5

There is no single command that will work.

-Nick
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
In reply to this post by llee782
llee782 <llee040 <at> sbcglobal.net> writes:

> Carl Eugen Hoyos wrote
> > Your MEncoder command line includes "-ofps 24000/1001".
> > How is this supposed to work for 30fps progressive
> > input?
>
> The inverse telecine operation must yield video of
> 23.94 fps rather than 29.97 fps, right?

Yes, if the input is telecined, you would do that.
But the input file you provided is progressive,
see command 4) in Nicholas' email.

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
In reply to this post by Nicholas Robbins-2
Nicholas Robbins <nickrobbins-at-yahoo.com <at> ffmpeg.org> writes:

> I've encountered the following on dvds:
>
> 1) 24 fps labeled 30fps
> 2) 24 fps telecined to 30fps
> 6) a mix of 1 & 2 in the same title

> The ffmpeg commands I use are:
> 1) -r 24000/1001 (I've also used -fps=24000/1001,
> but -r works better for me for this)

The fps filter has (imo very) strange characteristics,
some may call it broken: We have input files for which
it alternatingly drops and duplicates frames, it seems
not have a sufficient "buffer".
(But this is unrelated to pulllup / pulldown.)

> 6) -vf pullup,dejudder,fps=fps=24000/1001:round=zero

There is now (it was there before, but nobody realized
afaict):
-vf dejudder,fps=30000/1001,fieldmatch,decimate

> You have to use your eyes.

There is of course the idet filter that allows to
detect the non-mixed cases.

Carl Eugen

PS: A bug in decimate affecting the first five frames
of the output stream was reported and should be fixed
soon.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
In reply to this post by Carl Eugen Hoyos
Carl Eugen Hoyos wrote
llee782 <llee040 <at> sbcglobal.net> writes:

> Carl Eugen Hoyos wrote

Yes, if the input is telecined, you would do that.
But the input file you provided is progressive,


_________________________________________
But I don't believe the re-encoded video could play with integrity at 23.94 fps as it does using the encoding commands I already provided if the original content had no telecine to remove, could it?

Laine
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
llee782 <llee040 <at> sbcglobal.net> writes:

> But I don't believe the re-encoded video could play
> with integrity at 23.94 fps as it does using the
> encoding commands I already provided if the original
> content had no telecine to remove, could it?

Do you believe that the input video you provided is
telecined?

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
Carl Eugen Hoyos wrote
Do you believe that the input video you provided is
telecined?
I do. What else could explain the fact that the conversion to h264 results in video that contains no skipped frames when played at 23.94 fps? I know that 29.97 fps is detected for the original. If that can be explained another way, I'm not aware of it. After reading your response, I guess my question is this. What besides telecining (pulldown) can give 5 frames a duration of 1/6 second at 29.97 fps where the 5th frame is not a duplicate of the 4th?

When trying to handle these, I always step through the frames for at least one brief passage to determine whether a pattern per 5 frames is noticeable. Before I was aware of pulldown,  I just deinterlaced and maintained the 29.97 fps frame rate. It was only after I began to notice the feeling of being slapped in the face 6 times per second caused by the duplicate frame during passages of smooth panning that I took the trouble to learn about pulldown.

Laine

Laine

Laine
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

llee782
In reply to this post by Nicholas Robbins-2
Nicholas Robbins-2 wrote
There is no single command that will work.

-Nick
OK, thanks. That gives me a lot of things to try. From what I had read on the list, I thought that the goal was  to offer a single solution that could be applied whenever telecine was involved. My observation is that telecine is nearly always involved when a commercial DVD title has a frame rate of 29.97 fps.

Laine
Reply | Threaded
Open this post in threaded view
|

Re: Pullup old MPEG-2

Carl Eugen Hoyos
In reply to this post by llee782
llee782 <llee040 <at> sbcglobal.net> writes:

> Carl Eugen Hoyos wrote
> > Do you believe that the input video you provided is
> > telecined?
>
> I do.

Although I live in PAL-land, I have often dealt with
telecined video when trying to reproduce bug reports.
As a long-time FFmpeg developer, allow me to assure
you that the video you uploaded is not telecined.

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
12