KMTTG Tivo and the Constant Frame Rate Option

HandBrake for Mac support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
adman17
Posts: 7
Joined: Fri Sep 15, 2017 12:24 am

KMTTG Tivo and the Constant Frame Rate Option

Post by adman17 »

I'm using a program called KMTTG which downloads files from a TiVO box and has options for encoding them in various flavors. My problem is that these files are out of sync unless I do the encryption in a second pass using Handbrake as opposed to using Handbrake settings within the KMTTG application.

I've figured out that the issue is that the files from Handbrake need to have the Constant Frame Rate option turned on.

KMTTG uses encoding profiles such as this:

<command>
HANDBRAKE -i INPUT -t 1 -c 1 -f mp4 -X 960 -e x264 -q 20 -a 1 -E faac -B 128 -R 48 -6 dpl2 -D 0.0 -x threads=CPU_CORES:level=30:cabac=0:ref=2:me=umh:bframes=0:subq=6:8x8dct=0:trellis=0:weightb=0 -v 1 -o OUTPUT

I'm guessing I need to add the --cfr option to this command line and I've tried that to no avail and I don't know enough about what I'm doing to come up with a solution

Does anyone have a suggestion as to how I might turn the above command line into one that might turn on the Constant Frame Rate option.

It's not the end of the world as I'm able to get what I need with the two pass option but I was hoping I could do what I want to do in the one pass using KMTTG only.
mduell
Veteran User
Posts: 8197
Joined: Sat Apr 21, 2007 8:54 pm

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by mduell »

What is your playback environment that requires CFR for audio sync? It sounds broken.
adman17
Posts: 7
Joined: Fri Sep 15, 2017 12:24 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by adman17 »

Clips playback fine in Quicktime Player but when imported into Adobe Premiere they're out of sync. So yeah, it's may be something in the Non Linear Editor that I could adjust but I haven't been able to figure that out. However, making sure that the Constant Frame Rate box is checked in the Mac Handbrake GUI does the trick. So rather than re-invent the wheel I was just hoping there was a way to enable the Constant Frame Rate option with a Handbrake CLI option that I could add to an encoding profile within KMTTG.
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by Woodstock »

What happens with Premiere if you import the file AFTER KMTTG decrypts the file, rather than feeding it to handbrake in between?

Let's eliminate suspects before we go too far. If the problem isn't present with handbrake bypassed, then we can look at the settings (which is where an encode log is NECESSARY).

If the problem is there without handbrake in the equation, then the problem is with Adobe Premiere, and different work-arounds might exist.
adman17
Posts: 7
Joined: Fri Sep 15, 2017 12:24 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by adman17 »

Excellent question. I don't think I ever bothered because the "raw" encrypted files from KMTTG are pretty big. But yes, I tried and they're out of sync too (though I question whether that is just a function of the files being too big for am iMac to play and keep in sync.)

But if I run this "raw" file though Handbrake with the Constant Frame Rate selected it plays fine and in sync in Premiere.

I'm thinking this is a fine workaround even if it is a two step process. Was just hoping someone had a tip that would allow me to use the KMTTG encode option - which is a one step and automate-able process.
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by Woodstock »

For what it is worth, if you want to see a lot of hate and discontent on internet, search for "Adobe Premiere variable frame rate input". It is an ongoing issue, apparently, where the "solution" is to get better source material, and use handbrake to fix the frame rate if you aren't "professional" enough to use a good video source.
adman17
Posts: 7
Joined: Fri Sep 15, 2017 12:24 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by adman17 »

Well, all I know is Handbrake with Constant Frame Rate works fine in Premiere so I go back to my original question. The guy who wrote KMTTG says I should be able to export a CLI setup from Handbrake and from that create an encoding profile to use within KMTTG. This would get me to my one step process. The problem, as far as I can tell, is that Handbrake for Mac doesn't have the "export to CLI" option. I'd need to be running the Windows or Linux versions but I only have access to a Mac just now.

So again, is there something I can add to this:

<command>
HANDBRAKE -i INPUT -t 1 -c 1 -f mp4 -X 960 -e x264 -q 20 -a 1 -E faac -B 128 -R 48 -6 dpl2 -D 0.0 -x threads=CPU_CORES:level=30:cabac=0:ref=2:me=umh:bframes=0:subq=6:8x8dct=0:trellis=0:weightb=0 -v 1 -o OUTPUT

that would turn on the Constant Frame Rate option? Again, I've tried sticking --cfr into this script but it doesn't seem to do the trick.

Thanks.
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by Woodstock »

Code: Select all

   -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
I think the key here is "or the source's average rate if no -r is given", so adding a -r flag (with appropriate frame rate) is probably necessary with the --cfr.
Deleted User 11865

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by Deleted User 11865 »

Nah, --cfr can work standalone (it uses the source's detected frame rate, which isn't always 100% accurate, but should be close enough for 99% of what's out there). If adding --cfr to the above doesn't work (i.e. doesn't produce CFR output), then we must see the HandBrakeCLI log (and, also, it's probably a KMTTG-related issue).
adman17
Posts: 7
Joined: Fri Sep 15, 2017 12:24 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by adman17 »

Thanks. Does it matter where in the encode profile the --cfr flag gets added?
Deleted User 11865

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by Deleted User 11865 »

Nope. Well, except you should not put it between an option and its argument, of course ;)
adman17
Posts: 7
Joined: Fri Sep 15, 2017 12:24 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by adman17 »

Thanks for the tips. It actually seems to be working (dropping the --cfr option into the existing KMTTG encoding profile).

What's weird is that I'm sure I've tried this before without success, and now it works? So many variables though (new KMTTG, new Premiere) so it's hard to say what's making it work. But perhaps I should leave well enough alone?

Thanks again.
mduell
Veteran User
Posts: 8197
Joined: Sat Apr 21, 2007 8:54 pm

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by mduell »

Without a copy of the encode log from prior attempts, there's no saying what you did or did not do.
adman17
Posts: 7
Joined: Fri Sep 15, 2017 12:24 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by adman17 »

Well, it's all above my pay grade for sure. All I can tell you is that this results in files that are out of sync in Premiere:

# Description (single line, keep short)
<description>
Handbrake iPhone: mp4 container, res x=960 h.264 video, aac audio

# Encode command or script (single line)
# Known keywords: FFMPEG, MENCODER, HANDBRAKE, PERL, INPUT, OUTPUT, PWD, CPU_CORES, SRTFILE
<command>
HANDBRAKE -i INPUT -t 1 -c 1 -f mp4 -X 960 -e x264 -q 20 -a 1 -E faac -B 128 -R 48 -6 dpl2 -D 0.0 -x threads=CPU_CORES:level=30:cabac=0:ref=2:me=umh:bframes=0:subq=6:8x8dct=0:trellis=0:weightb=0 -v 1 -o OUTPUT

# Encoded output file extension
<extension>
m4v



While this (exactly the same but with the --cfr inserted) seems to create files that work perfectly within Premiere.

# Description (single line, keep short)
<description>
Handbrake iPhone: mp4 container, res x=960 h.264 video, aac audio

# Encode command or script (single line)
# Known keywords: FFMPEG, MENCODER, HANDBRAKE, PERL, INPUT, OUTPUT, PWD, CPU_CORES, SRTFILE
<command>
HANDBRAKE -i INPUT -t 1 -c 1 -f mp4 --cfr -X 960 -e x264 -q 20 -a 1 -E faac -B 128 -R 48 -6 dpl2 -D 0.0 -x threads=CPU_CORES:level=30:cabac=0:ref=2:me=umh:bframes=0:subq=6:8x8dct=0:trellis=0:weightb=0 -v 1 -o OUTPUT

# Encoded output file extension
<extension>
m4v
mduell
Veteran User
Posts: 8197
Joined: Sat Apr 21, 2007 8:54 pm

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by mduell »

That's a known limitation of Premiere and a couple other editing suites; they're living in the stoneage of CFR video.

We'd need the log to tell you why your previous attempts at CFR didn't get you video that worked in Premiere.
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: KMTTG Tivo and the Constant Frame Rate Option

Post by Woodstock »

For what it is worth, the command line does not generally generate a log on disk. If you were using it directly, and wanted to log the results, you would add "2> /path/to/log/file" (changed to match where you wan the log file to be) to the command line.

However, it is likely that KMTTG is capturing the output already, assuming you're not seeing a lot of data flash by on the screen while the encode is going on. You would need to find that log, OR manually run the command line with the redirect to the log file added.
Post Reply