Converting 60i to 60p

Hi there. I’ve been recording programs in Plex from OTA sources, via HDHomeRun, and I’ve gotten MCEBuddy to kick in and convert files reliably. But I’m beating my head against a wall with one particular part of the conversion.

For programs which air in 1080i60, MCEBuddy treats them as if they are running at 29.97 fps (this is technically correct, but there are 60 fields/second, and that does affect the temporal resolution). That means that on export, I get a 1080p30 file, seemingly no matter what profile I use, and what encoder I go for. This is an issue because it should be possible to get a 1080p60 file, using something like a bob or yadif deinterlacer, which would keep the temporal resolution of 60p. In fact, this is what Plex and my TV itself do to display the original .ts files at a smooth 60p, and it looks great.

I can get the standalone Handbrake app to export a file this way, so it’s definitely possible.

I’ve tried manually specifying 59.94 fps in the Expert Settings, but even that yields a 29.97 fps exported file. Is there some way to get MCEBuddy to determine the output framerate based on the number of fields per second, rather than the number of frames in the source file? Or is there another workaround I can use to get a matching export? Thanks.

This is an interesting topic, I think I found what is going on.

I think the “problem” is that MCEbuddy is choosing Handbrake as the encoding program and the way MCEbuddy passes your framerate (the one you specify in the GUI) into Handbrake is by adding the commandline parameter -r 59.94

The usage of the -r parameter defaults to setting peak framerate, so its telling handbrake to pick a framerate no higher than (59.94) instead of forcing it. It seems like it picks one in the 29.xx range with this…

I think there are a few ways to get around this, then:

  1. don’t use handbrake (bad option)
  2. use a default profile where ffmpeg priority is higher than handbrake (bad option)
  3. tack -cfr to the end of handbrake-general in your profile (best option)

ie for option3, in profiles.conf the profile [mp4 normal]:

handbrake-general=--decomb --loose-anamorphic --verbose=2 -f mp4 -O 

becomes

handbrake-general=--decomb --loose-anamorphic --verbose=2 -f mp4 -O --cfr

You can quickly test that this is the problem by using a profile where ffmpeg is higher priority. Use the [DivX AVI Normal] profile with 59.54 set in the gui, it uses ffmpeg.
Here are my results from that:

Video
ID                                       : 1
Format                                   : xvid
Codec ID                                 : xvid
Duration                                 : 26 s 994 ms
Bit rate                                 : 1 826 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 072 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 59.940 (60000/1001) FPS
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.015
Stream size                              : 5.87 MiB (87%)

For the explanation, this is taken directly from the handbrakecli documentation:

   -r, --rate <float>      Set video framerate
                       (5/10/12/15/20/23.976/24/25/29.97/
                       30/48/50/59.94/60/72/75/90/100/120
                       or a number between 1 and 1000).
                       Be aware that not specifying a framerate lets
                       HandBrake preserve a source's time stamps,
                       potentially creating variable framerate video

--vfr, --cfr, --pfr     Select variable, constant or peak-limited
                       frame rate control. VFR preserves the source
                       timing. CFR makes the output constant rate at
                       the rate given by the -r flag (or the source's
                       average rate if no -r is given). PFR doesn't
                       allow the rate to go over the rate specified
                       with the -r flag but won't change the source
                       timing if it's below that rate.
                       If none of these flags are given, the default
                       is --pfr when -r is given and --vfr otherwise

Finally, I’m not exactly sure that doubleing the framerate is what you want. If a video is deinterlaced to 30fps, you don’t do anything by then doubling that to 60, which may be what setting the framerate is doing. Not extactly sure but I think you want to double framerate and modify deinterlacer settings.

Here is what I think based off my limited understanding, and I’m not sure how plex does it, decomb does it, and how yadif differs:

Example
60i fps, frames over 3seconds of video:

ABCDEFGH

30p fps, frames over 3seconds of video:

ACEG

60p fps, frames over 3seconds of video, after doubling the framerate by setting
-r 59.94 -cfr :

AACCEEGG

In the above, 30p and 60p should look the same to a human, right? The “framerate” doubled but the frames are the same so no difference visually?

Really what you want is
60i fps, frames over 3seconds of video:

ABCDEFGH

60p fps, frames over 3seconds of video:

ABCDEFGH

And in order to get this desired effect I think you need to modify your deinterlace settings.
See this: https://avisynth.org.ru/yadif/yadif.html

These are the settings in MCEbuddy for yadif, which do not change ever:

yadif=0:-1:1 

MCEbuddy Handbrake on the other hand uses

--decomb (default decomb settings / no preset)

From the docs:

    --decomb[=string]   Deinterlace video using a combination of yadif,
                       blend, cubic, or EEDI2 interpolation.

                       Presets:
                           bob
                           eedi2
                           eedi2bob

You can see why decomb is good, it first calculates if it even needs to deinterlace (it keeps the frames if there is no combing and if it does need to deinterlace, uses a mixture of deinterlacing methods (which it calculates which one would be best to use at that time in the video).

So, I’m sure that decomb would benefit in its default state by doubling the framerate, but I’m not sure if the actual benefit you’re looking for requires

--decomb=bob 

instead? And setting this would require a custom profile and might be affected in MCEbuddy by changing auto int detect.

A good test would be to do force framerate in handbrake GUI using decomb default and decomb BOB, let me know if you can tell a difference

Thanks so much. I saw your earlier post, and basically wound up at the same conclusion you come to here. The trick to getting smooth playback from the Handbrake GUI is indeed turning Decomb on, and setting it to Bob. I don’t even need to specify a framerate; it just takes care of the problem.

I just modified the “MKV Normal” Profile and added decomb=bob to it:

handbrake-general=--decomb=bob --detelecine --loose-anamorphic --verbose=2 -O

I’m actually hoping that I don’t need to add -cfr to it at all, because that’s not necessary in the GUI version. In an ideal world, this preset would also detelecine shows that were shot in, say, 24 fps, so I’m trying to get to a place where with one single profile, MCEBuddy always outputs a file that matches the true source material.

I have it running on a test file now, and I’ll check back in here once it’s run. Thanks again.

Great! From your post it seemed like you were so close to the answer that I was confused, but after I looked it was a little more nuanced.

You notice a difference between
1080i60 -> 1080p30
and
1080i60 -> 1080p60 --decomb / --decomb bob
?

Wondering, may take a look into it, never thought of it

Just finished up the test, and it looks terrific. I definitely notice a difference with --decomb on; the motion is way, way smoother than 1080p30. The output is now visually indistinguishable from the input file. (That may also be because it’s double the filesize, so bitrate/quality are the next problem to tackle…)

Glad you got this solved as I’m running into this as well. Do you still need to specify 59.94 fps in the Expert Settings with this method?

I have tried using handbrake-general=--decomb=bob --detelecine --loose-anamorphic --verbose=2 -O with no luck.

I end up choppy 30fps framerate. I’ve also given up on the idea of deinterlacing my video and just using MCEBuddy to trim out the commercials but now I can’t even get that to work.

  1. No combination of AutoDeinterlace=false, ffmpeg-VideoOptimized=true, handbrake-VideoOptimized=true with any default profile is preserving my 60 fields per second interlaced video.

  2. Using MP4 Unprocessed similarly does not preserve the fields per second and I end up with a 1080i30 choppy video.

I’m not sure what else to do at this point. Could use some advice!